Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stateless and Extra Token Claim Config does not work together #445

Closed
shaardie opened this issue Nov 6, 2023 · 5 comments
Closed

Stateless and Extra Token Claim Config does not work together #445

shaardie opened this issue Nov 6, 2023 · 5 comments
Assignees
Labels

Comments

@shaardie
Copy link
Contributor

shaardie commented Nov 6, 2023

During responding to the token request, satosa tries to get the configured extra troken claims from the provider.userinfo, see https://github.com/IdentityPython/SATOSA/blob/master/src/satosa/frontends/openid_connect.py#L367, but since the informations are not in the database (or the dict) , but in the token, this fails with a Traceback.

Code Version

v8.4.0

Expected Behavior

Get the token and no Traceback.

Current Behavior

Traceback

Possible Solution

The provider already hat logic to get the get the extra token claims from the request. So the solution is simply not set extra_token_claims at this point:

try:
response = self.provider.handle_token_request(
urlencode(context.request),
headers,
lambda user_id, client_id: self._get_extra_id_token_claims(user_id, client_id))
return Response(response.to_json(), content="application/json")

and simply call

response = self.provider.handle_token_request(urlencode(context.request), headers)

Steps to Reproduce

  1. Configure Stateless and extra Token Claims for a Client in the OIDC Frontend.
  2. Try to authenticate
  3. Traceback
@c00kiemon5ter
Copy link
Member

@smalihaider would you have a look into this?

@smalihaider
Copy link

@smalihaider would you have a look into this?

Sure @c00kiemon5ter

@fredericoschardong
Copy link

I confirm @shaardie's suggestion fixes the error. Should I create a PR for this?

@smalihaider
Copy link

@shaardie @fredericoschardong Apologies for reverting late on this. Thank you for your analysis, however, the suggested fix does not consider non-stateless flows. In the case of non-stateless flows, the extra_id_token_claims should be retrieved via the user info (db or dict) just like it was done before the introduction of the stateless code flow.

I have created this PR to fix this issue in rather pyop: IdentityPython/pyop#55

@c00kiemon5ter
Copy link
Member

Fixed with v3.4.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants