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

Create new client if old client is older than 60 s #1226

Merged
merged 3 commits into from
Jul 29, 2024
Merged

Conversation

Koenvh1
Copy link
Contributor

@Koenvh1 Koenvh1 commented Jul 16, 2024

Based on ramosbugs/openidconnect-rs#152 and some discussions with @partim , it seems like the OpenID connect client does not automatically rediscover anything, leading to login loops when e.g. the JWKs are rolled (as the signature can no longer be verified).

2024-06-27 10:29:15 [WARN] OpenID Connect: ID token verification failed: Signature verification failed [additional info: caused by: Signature verification failed, caused by: No matching key found]

This PR adds an explicit lifetime to the connection, and if the connection has existed for more than 60 seconds, it will initialise a new client. This is a tradeoff between doing rediscovery on every request (so requesting the /.well-known/openid-configuration endpoint, the jwk_uri inside that, and then the endpoint for the userinfo), which might slow things down on grouped requests, whilst also reasonably quickly learning about configuration changes.

The 60 seconds is arbitrary, and it might be nicer to make this configurable or document it somehow. Even nicer would be to honour the cache lifetimes of the HTTP responses, but I am not sure whether that is worth the effort.

@Koenvh1 Koenvh1 added bug Something isn't working openidconnect labels Jul 16, 2024
@Koenvh1 Koenvh1 requested a review from a team July 16, 2024 10:46
@Koenvh1 Koenvh1 self-assigned this Jul 16, 2024
@partim partim merged commit 7ba7e22 into main Jul 29, 2024
18 checks passed
@partim partim deleted the oidc-jwk-roll branch July 29, 2024 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working openidconnect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants