88from cryptojwt import KeyJar
99from jinja2 import Environment
1010from jinja2 import FileSystemLoader
11+ from requests import request
1112
1213from idpyoidc .context import OidcContext
1314from idpyoidc .server import authz
1920from idpyoidc .server .scopes import SCOPE2CLAIMS
2021from idpyoidc .server .scopes import Scopes
2122from idpyoidc .server .session .manager import SessionManager
22- from idpyoidc .server .session .manager import create_session_manager
2323from idpyoidc .server .template_handler import Jinja2TemplateHandler
2424from idpyoidc .server .user_authn .authn_context import populate_authn_broker
2525from idpyoidc .server .util import get_http_params
2626from idpyoidc .util import importer
2727from idpyoidc .util import rndstr
28- from requests import request
2928
3029logger = logging .getLogger (__name__ )
3130
@@ -61,14 +60,14 @@ def get_token_handler_args(conf: dict) -> dict:
6160 :param conf: The configuration
6261 :rtype: dict
6362 """
64- th_args = conf .get ("token_handler_args" , None )
65- if not th_args :
66- th_args = {
63+ token_handler_args = conf .get ("token_handler_args" , None )
64+ if not token_handler_args :
65+ token_handler_args = {
6766 typ : {"lifetime" : tid }
6867 for typ , tid in [("code" , 600 ), ("token" , 3600 ), ("refresh" , 86400 )]
6968 }
7069
71- return th_args
70+ return token_handler_args
7271
7372
7473class EndpointContext (OidcContext ):
@@ -88,7 +87,7 @@ class EndpointContext(OidcContext):
8887 "jwks_uri" : "" ,
8988 "keyjar" : KeyJar ,
9089 "login_hint_lookup" : None ,
91- "login_hint2acrs" : {} ,
90+ "login_hint2acrs" : None ,
9291 "par_db" : {},
9392 "provider_info" : {},
9493 "registration_access_token" : {},
@@ -102,19 +101,19 @@ class EndpointContext(OidcContext):
102101 "client_authn_method" : {},
103102 }
104103
105- init_args = ["upstream_get" , "handler " ]
104+ init_args = ["upstream_get" , "conf " ]
106105
107106 def __init__ (
108- self ,
109- conf : Union [dict , OPConfiguration ],
110- upstream_get : Callable ,
111- cwd : Optional [str ] = "" ,
112- cookie_handler : Optional [Any ] = None ,
113- httpc : Optional [Any ] = None ,
114- server_type : Optional [str ] = "" ,
115- entity_id : Optional [str ] = "" ,
116- keyjar : Optional [KeyJar ] = None ,
117- claims_class : Optional [Claims ] = None ,
107+ self ,
108+ conf : Union [dict , OPConfiguration ],
109+ upstream_get : Callable ,
110+ cwd : Optional [str ] = "" ,
111+ cookie_handler : Optional [Any ] = None ,
112+ httpc : Optional [Any ] = None ,
113+ server_type : Optional [str ] = "" ,
114+ entity_id : Optional [str ] = "" ,
115+ keyjar : Optional [KeyJar ] = None ,
116+ claims_class : Optional [Claims ] = None ,
118117 ):
119118 _id = entity_id or conf .get ("issuer" , "" )
120119 OidcContext .__init__ (self , conf , entity_id = _id )
@@ -185,7 +184,7 @@ def __init__(
185184 except KeyError :
186185 pass
187186
188- self .th_args = get_token_handler_args (conf )
187+ self .token_handler_args = get_token_handler_args (conf )
189188
190189 # session db
191190 self ._sub_func = {}
@@ -249,12 +248,11 @@ def __init__(
249248
250249 self .setup_authentication ()
251250
252- self .session_manager = create_session_manager (
253- self .unit_get ,
254- self .th_args ,
251+ self .session_manager = SessionManager (
252+ self .token_handler_args ,
255253 sub_func = self ._sub_func ,
256- conf = self . conf ,
257- )
254+ conf = conf ,
255+ upstream_get = self . unit_get )
258256
259257 self .do_userinfo ()
260258
@@ -276,7 +274,8 @@ def setup_authz(self):
276274 return authz .Implicit (self .unit_get )
277275
278276 def setup_client_authn_methods (self ):
279- self .client_authn_methods = client_auth_setup (self .unit_get , self .conf .get ("client_authn_methods" ))
277+ self .client_authn_methods = client_auth_setup (self .unit_get ,
278+ self .conf .get ("client_authn_methods" ))
280279
281280 def setup_login_hint_lookup (self ):
282281 _conf = self .conf .get ("login_hint_lookup" )
0 commit comments