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

Commit 46f2e61

Browse files
committed
Merge branch 'master' of github.com:IdentityPython/oidcendpoint
2 parents 4a180bd + 7c3951e commit 46f2e61

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/oidcendpoint/session.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ def setup_session(
7272
sid = endpoint_context.sdb.create_authz_session(
7373
authn_event, areq, client_id=client_id, uid=uid
7474
)
75-
endpoint_context.sdb.do_sub(sid, uid, "")
75+
76+
client_salt = endpoint_context.cdb.get(client_id, {}).get('client_salt', salt)
77+
endpoint_context.sdb.do_sub(sid, uid, client_salt)
7678
return sid
7779

7880

@@ -90,14 +92,14 @@ class SessionInfo(Message):
9092
}
9193

9294

93-
def pairwise_id(uid, sector_identifier, client_salt, **kwargs):
95+
def pairwise_id(uid, sector_identifier, salt, **kwargs):
9496
return hashlib.sha256(
95-
("%s%s%s" % (uid, sector_identifier, client_salt)).encode("utf-8")
97+
("%s%s%s" % (uid, sector_identifier, salt)).encode("utf-8")
9698
).hexdigest()
9799

98100

99-
def public_id(uid, user_salt="", **kwargs):
100-
return hashlib.sha256("{}{}".format(uid, user_salt).encode("utf-8")).hexdigest()
101+
def public_id(uid, salt="", **kwargs):
102+
return hashlib.sha256("{}{}".format(uid, salt).encode("utf-8")).hexdigest()
101103

102104

103105
def dict_match(a, b):
@@ -260,8 +262,7 @@ def do_sub(
260262
"""
261263
sub = self.sub_func[subject_type](
262264
uid,
263-
user_salt=user_salt,
264-
client_salt=client_salt,
265+
salt=client_salt or user_salt,
265266
sector_identifier=sector_id,
266267
)
267268

tests/test_08_session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ def test_do_sub_deterministic(self):
344344
info = self.sdb[sid]
345345
assert (
346346
info["sub"]
347-
== "04f8996da763b7a969b1028ee3007569eaf3a635486ddab211d512c85b9df8fb"
347+
== "d657bddf3d30970aa681663978ea84e26553ead03cb6fe8fcfa6523f2bcd0ad2"
348348
)
349349

350350
self.sdb.do_sub(

0 commit comments

Comments
 (0)