Skip to content
This repository was archived by the owner on Jun 12, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/oidcendpoint/client_authn.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ def verify_client(
_token = auth_info.get("token")

if client_id:

if not client_id in endpoint_context.cdb:
raise ValueError("Unknown Client ID")

Expand Down
19 changes: 11 additions & 8 deletions src/oidcendpoint/endpoint_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from oidcendpoint import authz
from oidcendpoint import rndstr
from oidcendpoint import util
from oidcendpoint.client_authn import CLIENT_AUTHN_METHOD
from oidcendpoint.id_token import IDToken
from oidcendpoint.session import create_session_db
Expand Down Expand Up @@ -44,7 +43,7 @@ def init_user_info(conf, cwd):
kwargs["db_file"] = os.path.join(cwd, kwargs["db_file"])

if isinstance(conf["class"], str):
return util.importer(conf["class"])(**kwargs)
return importer(conf["class"])(**kwargs)

return conf["class"](**kwargs)

Expand All @@ -56,7 +55,7 @@ def init_service(conf, endpoint_context=None):
kwargs["endpoint_context"] = endpoint_context

if isinstance(conf["class"], str):
return util.importer(conf["class"])(**kwargs)
return importer(conf["class"])(**kwargs)

return conf["class"](**kwargs)

Expand Down Expand Up @@ -126,14 +125,19 @@ def __init__(
# arguments for endpoints add-ons
self.args = {}

self.th_args = get_token_handlers(conf)

# client database
self.cdb = client_db or {}

# session db
self._sub_func = {}
self.do_sub_func()
self.sdb = session_db
if not self.sdb:

# set self.sdb
if session_db:
self.set_session_db(conf, sso_db, db=session_db)
else:
self.set_session_db(conf, sso_db)

self.scope2claims = SCOPE2CLAIMS
Expand Down Expand Up @@ -284,14 +288,13 @@ def do_sub_func(self):
self._sub_func[key] = init_service(args)
elif "function" in args:
if isinstance(args["function"], str):
self._sub_func[key] = util.importer(args["function"])
self._sub_func[key] = importer(args["function"])
else:
self._sub_func[key] = args["function"]

def do_session_db(self, conf, sso_db, db=None):
th_args = get_token_handlers(conf)
self.sdb = create_session_db(
self, th_args, db=db,
self, self.th_args, db=db,
sso_db=sso_db,
sub_func=self._sub_func
)
Expand Down
1 change: 0 additions & 1 deletion src/oidcendpoint/oidc/authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ def get_uri(endpoint_context, request, uri_type):
verify_uri(endpoint_context, request, uri_type)
uri = request[uri_type]
else:

uris = "{}s".format(uri_type)
client_id = str(request["client_id"])
if client_id in endpoint_context.cdb:
Expand Down
9 changes: 4 additions & 5 deletions src/oidcendpoint/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def dict_match(a, b):


class SessionDB(object):
def __init__(self, db, handler, sso_db, userinfo=None, sub_func=None):
def __init__(self, db, handler, sso_db=SSODb(), userinfo=None, sub_func=None):
# db must implement the InMemoryDataBase interface
self._db = db
self.handler = handler
Expand Down Expand Up @@ -568,10 +568,9 @@ def get_authentication_event(self, sid):


def create_session_db(ec, token_handler_args, db=None,
sso_db=SSODb(), sub_func=None):
sso_db=None, sub_func=None):
_token_handler = token_handler.factory(ec, **token_handler_args)

if not db:
db = InMemoryDataBase()

db = db or InMemoryDataBase()
sso_db = sso_db or SSODb()
return SessionDB(db, _token_handler, sso_db, sub_func=sub_func)