Skip to content

Commit

Permalink
Use session_state to backup consumer state if available
Browse files Browse the repository at this point in the history
  • Loading branch information
gbip committed Apr 3, 2023
1 parent 3b1a9c3 commit d07324f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/oic/oic/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,12 @@ def parse_authz(
self.verify_id_token(idt, self.authz_req.get(_state or atr["state"]))
return aresp, atr, idt

def complete(self, state, authn_method: str = "client_secret_basic"):
def complete(
self,
state,
session_state: Optional[str] = None,
authn_method: str = "client_secret_basic",
):
"""
Do the access token request, the last step in a code flow.
Expand Down Expand Up @@ -496,7 +501,12 @@ def complete(self, state, authn_method: str = "client_secret_basic"):
if resp.type() == "ErrorResponse":
raise TokenError(resp.error, resp)

self._backup(state)
if session_state:
# Use session_state from Authorization server, as per §2
# from https://openid.net/specs/openid-connect-session-1_0.html
self._backup(session_state)
else:
self._backup(state)

return resp

Expand Down

0 comments on commit d07324f

Please sign in to comment.