Skip to content
This repository was archived by the owner on Jun 12, 2021. It is now read-only.

Commit 85d91e3

Browse files
committed
get_token_handlers decoupled from do_session_db
1 parent 89a21dd commit 85d91e3

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

src/oidcendpoint/endpoint_context.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,9 @@ def do_sub_func(self, conf):
331331
else:
332332
self._sub_func[key] = args["function"]
333333

334-
def do_session_db(self, conf):
335-
try:
336-
_th_args = conf["token_handler_args"]
337-
except KeyError:
334+
def get_token_handlers(self, conf):
335+
th_args = conf.get("token_handler_args", None)
336+
if not th_args:
338337
# create 3 keys
339338
keydef = [
340339
{"type": "oct", "bytes": "24", "use": ["enc"], "kid": "code"},
@@ -347,13 +346,16 @@ def do_session_db(self, conf):
347346
"key_defs": keydef,
348347
"read_only": False,
349348
}
350-
351-
_th_args = {"jwks_def": jwks_def}
349+
th_args = {"jwks_def": jwks_def}
352350
for typ, tid in [("code", 600), ("token", 3600), ("refresh", 86400)]:
353-
_th_args[typ] = {"lifetime": tid}
351+
th_args[typ] = {"lifetime": tid}
352+
353+
return th_args
354354

355+
def do_session_db(self, conf):
356+
th_args = self.get_token_handlers(conf)
355357
self.sdb = create_session_db(
356-
self, _th_args, db=None, sso_db=SSODb(), sub_func=self._sub_func
358+
self, th_args, db=None, sso_db=SSODb(), sub_func=self._sub_func
357359
)
358360

359361
def do_endpoints(self, conf):

0 commit comments

Comments
 (0)