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

OIDC ID token auto-refresh support #11771

Merged
merged 1 commit into from
Sep 2, 2020

Conversation

sberyozkin
Copy link
Member

This PR follows up #11718 (which adds an option to extend the session in order to keep RT around for longer) and adds another option to auto-refresh ID tokens if the validated ID token will expire within the configured token.auto-refresh-interval.
This should offer a more robust solution, as extending the session on its own only relies on the possibility of the OP session still being active for the RT grant to work.
I've added a test and also verified that without adding a new property in the new tenant-autorefresh configuration the test fails.

In this PR an exception is thrown for the recovery code in CodeAuthenticationMechanism which does refresh the tokens and updates the session to take control. The exception is thrown only after the ID token has been verified and the SecurityIdentity calculated - the difference in this case is that if the RT grant fails we still continue because the current ID token is still valid (not expired).
Also some precautions are taken to 1) avoid auto-refreshing on the initial authentication request and 2) avoid looping as the refreshed tokens also get verified.

@sberyozkin
Copy link
Member Author

@gastaldi Hi George, by the way, I've realized that since we use Duration the users can use whatever format they prefer :-), so it is really just a recommendation to use seconds or minutes for a given property

@gsmet
Copy link
Member

gsmet commented Sep 1, 2020

Looks like the tests are failing.

@sberyozkin
Copy link
Member Author

Hi @gsmet I see the kubernetes-client test failing, I'll rebase

@sberyozkin sberyozkin force-pushed the oidc_refresh_token_time branch from 9af5f0f to e803e30 Compare September 1, 2020 13:33
@gsmet gsmet force-pushed the oidc_refresh_token_time branch from e803e30 to 3ca144a Compare September 1, 2020 14:06
@gsmet
Copy link
Member

gsmet commented Sep 1, 2020

I disabled the failing test in master, rebased and force-pushed.

@gsmet gsmet merged commit cb32eef into quarkusio:master Sep 2, 2020
@gsmet
Copy link
Member

gsmet commented Sep 2, 2020

Better include that one in CR1 to get feedback.

@sberyozkin
Copy link
Member Author

@gsmet Thanks Guillaume, good idea

@sberyozkin sberyozkin deleted the oidc_refresh_token_time branch September 2, 2020 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants