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

Update OIDC TokenStateManager to return Uni #19807

Merged
merged 1 commit into from
Sep 1, 2021

Conversation

sberyozkin
Copy link
Member

@sberyozkin sberyozkin commented Aug 31, 2021

Fixes #19670

It proved a bit more complicated than I thought it would be - but I believe it all works fine now. TokenStateManager has 3 methods, so I had to refactor CodeAuthenticationMechanism a little bit as the code parts which call TokenStateManager do not fit well into SecurityIdentity -> Uni<SecurityIdentity> transformation, so I just used call:

  • CodeAuthenticationMechanism#processSuccessfulAuthentication is called on a new and refresh authentication request, after SecurityIdentity has been created, to create a cookie with a value from TokenStateManager#createTokenState but before completing authentication
  • TokenStateManager#getTokens is called before the token is verified, to convert the cookie value into the tokens
  • TokenStateManager#deleteTokens is called from 3 places in CodeAuthenticationMechanism, originally from CodeAuthenticationMechanism#removeToken but since removeCookie is also used for other cookies I moved TokenStateManager#deleteTokens call out of it into a dedicated removeSessionCookie

Updated one of the tests to actually stress CustomTokenStateManager#deleteTokens and updated the docs.

Also a few deprecation related updates related to the earlier fix from Stuart to TenantConfigResolver (with the update to 2.2 migration guide).

Nothing has changed as far as the actual OIDC processing is concerned.

Also CC @cescoffier

@sberyozkin sberyozkin force-pushed the uni_token_state_manager branch from cd3fd86 to e4d2bcf Compare August 31, 2021 17:14
@sberyozkin sberyozkin merged commit 87c17a3 into quarkusio:main Sep 1, 2021
@quarkus-bot quarkus-bot bot added this to the 2.3 - main milestone Sep 1, 2021
@sberyozkin sberyozkin deleted the uni_token_state_manager branch September 1, 2021 09:11
@gsmet gsmet modified the milestones: 2.3 - main, 2.2.2.Final Sep 6, 2021
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.

io.quarkus.oidc.TokenStateManager called from event loop thread
3 participants