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

Commit 6dd6b4b

Browse files
committed
For debugging purpose nice to know what was put in the ID Token and also what was in a received ID Token.
1 parent 07ad50d commit 6dd6b4b

4 files changed

Lines changed: 24 additions & 1 deletion

File tree

example/flask_op/views.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def _add_cookie(resp, cookie_spec):
3232
for k,v in cookie_spec.items()
3333
if k not in ('name',)}
3434
kwargs["path"] = "/"
35+
kwargs["samesite"] = "Lax"
3536
resp.set_cookie(cookie_spec["name"], **kwargs)
3637

3738

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
oidcmsg>=1.3.0
1+
oidcmsg>=1.4.0
22
pyyaml
33
jinja2>=2.11.3
44
responses>=0.13.0

src/oidcop/token/id_token.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ def payload(
134134
self, session_id, alg="RS256", code=None, access_token=None, extra_claims=None,
135135
):
136136
"""
137+
Collect payload for the ID Token.
137138
138139
:param session_id: Session identifier
139140
:param alg: Which signing algorithm to use for the IdToken
@@ -197,6 +198,8 @@ def payload(
197198
except KeyError:
198199
pass
199200

201+
logger.debug(f"Constructed ID Token payload: {_args}")
202+
200203
return _args
201204

202205
def sign_encrypt(
@@ -297,6 +300,8 @@ def info(self, token):
297300
except JWSException:
298301
raise UnknownToken()
299302

303+
logger.debug(f"Received ID Token payload: {_payload}")
304+
300305
if is_expired(_payload["exp"]):
301306
raise ToOld("Token has expired")
302307
# All the token metadata

tests/test_05_id_token.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,3 +609,20 @@ def test_id_token_acr_claim(self):
609609
_jwt = factory(id_token.value)
610610
_id_token_content = _jwt.jwt.payload()
611611
assert _id_token_content["acr"] == "https://refeds.org/profile/mfa"
612+
613+
def test_id_token_acr_none(self):
614+
_req = AREQS.copy()
615+
_req["claims"] = {"id_token": {"acr": None}}
616+
617+
session_id = self._create_session(_req,authn_info="https://refeds.org/profile/mfa")
618+
grant = self.session_manager[session_id]
619+
code = self._mint_code(grant, session_id)
620+
access_token = self._mint_access_token(grant, session_id, code)
621+
622+
id_token = self._mint_id_token(
623+
grant, session_id, token_ref=code, access_token=access_token.value
624+
)
625+
626+
_jwt = factory(id_token.value)
627+
_id_token_content = _jwt.jwt.payload()
628+
assert _id_token_content["acr"] == "https://refeds.org/profile/mfa"

0 commit comments

Comments
 (0)