enhance state mismatch error message

This commit is contained in:
Rachid Mrad 2024-03-15 14:29:41 -04:00
parent e4b0f1ad43
commit 63c0aec4b8
No known key found for this signature in database

View file

@ -182,7 +182,11 @@ class Client(oic.Client):
if authn_response["state"] != session.get("state", None): if authn_response["state"] != session.get("state", None):
# this most likely means the user's Django session vanished # this most likely means the user's Django session vanished
logger.error("Received state not the same as expected for %s" % state) logger.error(
f"Received state not the same as expected for {state}"
f"authn_response['state'] = {authn_response['state']}"
f"session.get('state', None) = {session.get('state', None)}"
)
if session.get("state", None) is None: if session.get("state", None) is None:
raise o_e.NoStateDefined() raise o_e.NoStateDefined()
raise o_e.AuthenticationFailed(locator=state) raise o_e.AuthenticationFailed(locator=state)