Skip to content

Commit

Permalink
For the stateless flow, retrieve the extra_id_token_claims from the a…
Browse files Browse the repository at this point in the history
…uth_code in the request
  • Loading branch information
smalihaider-daasi authored and c00kiemon5ter committed Nov 6, 2024
1 parent edb7397 commit de52a30
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/pyop/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,16 +446,13 @@ def _do_code_exchange(self, request, # type: Dict[str, str]
if refresh_token is not None:
response['refresh_token'] = refresh_token

if extra_id_token_claims is None:
extra_id_token_claims = {}
elif callable(extra_id_token_claims):
if self.stateless:
extra_id_token_claims = extra_id_token_claims(sub, authentication_request['client_id'])
else:
extra_id_token_claims = extra_id_token_claims(user_id, authentication_request['client_id'])
extra_id_token_claims = {}
if self.stateless:
extra_id_token_claims_in_code = self.authz_state.get_extra_id_token_claims_for_code(token_request['code'])
extra_id_token_claims.update(extra_id_token_claims_in_code)
elif callable(extra_id_token_claims):
extra_id_token_claims = extra_id_token_claims(user_id, authentication_request['client_id'])

requested_claims = self._get_requested_claims_in(authentication_request, 'id_token')
if self.stateless:
user_info = self.authz_state.get_user_info_for_code(token_request['code'])
Expand Down

0 comments on commit de52a30

Please sign in to comment.