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

Commit 0fe8067

Browse files
authored
Merge pull request #71 from IdentityPython/session_params
BREAKAGE: configuration's password, salt and sub_funcs now are under session_params
2 parents eba18ec + 5916dd4 commit 0fe8067

5 files changed

Lines changed: 52 additions & 23 deletions

File tree

doc/source/contents/conf.rst

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,40 @@ issuer
99
The issuer ID of the OP, a unique value in URI format.
1010

1111

12-
--------
12+
--------------
13+
session params
14+
--------------
15+
16+
Configuration parameters used by session manager
17+
18+
"session_params": {
19+
"password": "__password_used_to_encrypt_access_token_sid_value",
20+
"salt": "salt involved in session sub hash ",
21+
"sub_func": {
22+
"public": {
23+
"class": "oidcop.session.manager.PublicID",
24+
"kwargs": {
25+
"salt": "sdfsdfdsf"
26+
}
27+
},
28+
"pairwise": {
29+
"class": "oidcop.session.manager.PairWiseID",
30+
"kwargs": {
31+
"salt": "sdfsdfsdf"
32+
}
33+
}
34+
}
35+
},
36+
1337
password
14-
--------
38+
########
1539

1640
Encryption key used to encrypt the SessionID (sid) in access_token.
1741
If unset it will be random.
1842

19-
----
43+
2044
salt
21-
----
45+
####
2246

2347
Salt, value or filename, used in sub_funcs (pairwise, public) for creating the opaque hash of *sub* claim.
2448

src/oidcop/configure.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def __init__(
218218
self.template_dir = None
219219
self.token_handler_args = {}
220220
self.userinfo = None
221-
self.password = None
221+
self.session_params = None
222222

223223
if file_attributes is None:
224224
file_attributes = DEFAULT_FILE_ATTRIBUTE_NAMES
@@ -265,7 +265,6 @@ def __init__(
265265
self.id_token = None
266266
self.login_hint2acrs = {}
267267
self.login_hint_lookup = None
268-
self.sub_func = {}
269268

270269
EntityConfiguration.__init__(self, conf=conf, base_path=base_path,
271270
entity_conf=entity_conf, domain=domain, port=port,

src/oidcop/endpoint_context.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,9 @@ def do_sub_func(self) -> None:
284284
285285
:return: string
286286
"""
287-
_conf = self.conf.get("sub_func", {})
288-
for key, args in _conf.items():
287+
ses_par = self.conf.get("session_params") or {}
288+
sub_func = ses_par.get("sub_func") or {}
289+
for key, args in sub_func.items():
289290
if "class" in args:
290291
self._sub_func[key] = init_service(args)
291292
elif "function" in args:

src/oidcop/session/manager.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ def __init__(
7777
self.conf = conf or {}
7878

7979
# these won't change runtime
80-
self._key = self.conf.get("password") or rndstr(24)
81-
self._salt = self.conf.get("salt") or rndstr(32)
80+
session_params = self.conf.get("session_params") or {}
81+
self._key = session_params.get("password") or rndstr(24)
82+
self._salt = session_params.get("salt") or rndstr(32)
8283

8384
self.key = self.load_key()
8485
self.salt = self.load_key()

tests/op_config.json

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -268,19 +268,23 @@
268268
}
269269
}
270270
},
271-
"sub_func": {
272-
"public": {
273-
"class": "oidcop.session.manager.PublicID",
274-
"kwargs": {
275-
"filename": "public.salt"
276-
}
277-
},
278-
"pairwise": {
279-
"class": "oidcop.session.manager.PairWiseID",
280-
"kwargs": {
281-
"filename": "pairwise.salt"
282-
}
283-
}
271+
"session_params": {
272+
"password": "__password_used_to_encrypt_access_token_sid_value",
273+
"salt": "salt involved in session sub hash ",
274+
"sub_func": {
275+
"public": {
276+
"class": "oidcop.session.manager.PublicID",
277+
"kwargs": {
278+
"salt": "sdfsdfdsf"
279+
}
280+
},
281+
"pairwise": {
282+
"class": "oidcop.session.manager.PairWiseID",
283+
"kwargs": {
284+
"salt": "sdfsdfsdf"
285+
}
286+
}
287+
}
284288
},
285289
"template_dir": "templates",
286290
"token_handler_args": {

0 commit comments

Comments
 (0)