1010
1111from oidcendpoint import authz
1212from oidcendpoint import rndstr
13- from oidcendpoint import util
1413from oidcendpoint .client_authn import CLIENT_AUTHN_METHOD
1514from oidcendpoint .id_token import IDToken
1615from oidcendpoint .session import create_session_db
@@ -44,7 +43,7 @@ def init_user_info(conf, cwd):
4443 kwargs ["db_file" ] = os .path .join (cwd , kwargs ["db_file" ])
4544
4645 if isinstance (conf ["class" ], str ):
47- return util . importer (conf ["class" ])(** kwargs )
46+ return importer (conf ["class" ])(** kwargs )
4847
4948 return conf ["class" ](** kwargs )
5049
@@ -56,7 +55,7 @@ def init_service(conf, endpoint_context=None):
5655 kwargs ["endpoint_context" ] = endpoint_context
5756
5857 if isinstance (conf ["class" ], str ):
59- return util . importer (conf ["class" ])(** kwargs )
58+ return importer (conf ["class" ])(** kwargs )
6059
6160 return conf ["class" ](** kwargs )
6261
@@ -126,14 +125,19 @@ def __init__(
126125 # arguments for endpoints add-ons
127126 self .args = {}
128127
128+ self .th_args = get_token_handlers (conf )
129+
129130 # client database
130131 self .cdb = client_db or {}
131132
132133 # session db
133134 self ._sub_func = {}
134135 self .do_sub_func ()
135- self .sdb = session_db
136- if not self .sdb :
136+
137+ # set self.sdb
138+ if session_db :
139+ self .set_session_db (conf , sso_db , db = session_db )
140+ else :
137141 self .set_session_db (conf , sso_db )
138142
139143 self .scope2claims = SCOPE2CLAIMS
@@ -284,14 +288,13 @@ def do_sub_func(self):
284288 self ._sub_func [key ] = init_service (args )
285289 elif "function" in args :
286290 if isinstance (args ["function" ], str ):
287- self ._sub_func [key ] = util . importer (args ["function" ])
291+ self ._sub_func [key ] = importer (args ["function" ])
288292 else :
289293 self ._sub_func [key ] = args ["function" ]
290294
291295 def do_session_db (self , conf , sso_db , db = None ):
292- th_args = get_token_handlers (conf )
293296 self .sdb = create_session_db (
294- self , th_args , db = db ,
297+ self , self . th_args , db = db ,
295298 sso_db = sso_db ,
296299 sub_func = self ._sub_func
297300 )
0 commit comments