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

Commit 277769b

Browse files
committed
custom db
1 parent bfc0618 commit 277769b

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/oidcendpoint/endpoint_context.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,19 @@ def __init__(
125125
# arguments for endpoints add-ons
126126
self.args = {}
127127

128+
self.th_args = get_token_handlers(conf)
129+
128130
# client database
129131
self.cdb = client_db or {}
130132

131133
# session db
132134
self._sub_func = {}
133135
self.do_sub_func()
134-
self.sdb = session_db
135-
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:
136141
self.set_session_db(conf, sso_db)
137142

138143
self.scope2claims = SCOPE2CLAIMS
@@ -288,9 +293,8 @@ def do_sub_func(self):
288293
self._sub_func[key] = args["function"]
289294

290295
def do_session_db(self, conf, sso_db, db=None):
291-
th_args = get_token_handlers(conf)
292296
self.sdb = create_session_db(
293-
self, th_args, db=db,
297+
self, self.th_args, db=db,
294298
sso_db=sso_db,
295299
sub_func=self._sub_func
296300
)

src/oidcendpoint/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def dict_match(a, b):
118118

119119

120120
class SessionDB(object):
121-
def __init__(self, db, handler, sso_db, userinfo=None, sub_func=None):
121+
def __init__(self, db, handler, sso_db=SSODb(), userinfo=None, sub_func=None):
122122
# db must implement the InMemoryDataBase interface
123123
self._db = db
124124
self.handler = handler

0 commit comments

Comments
 (0)