Update OIDC TokenStateManager to return Uni #19807
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 refactorCodeAuthenticationMechanism
a little bit as the code parts which callTokenStateManager
do not fit well intoSecurityIdentity -> Uni<SecurityIdentity>
transformation, so I just usedcall
:CodeAuthenticationMechanism#processSuccessfulAuthentication
is called on a new and refresh authentication request, afterSecurityIdentity
has been created, to create a cookie with a value fromTokenStateManager#createTokenState
but before completing authenticationTokenStateManager#getTokens
is called before the token is verified, to convert the cookie value into the tokensTokenStateManager#deleteTokens
is called from 3 places inCodeAuthenticationMechanism
, originally fromCodeAuthenticationMechanism#removeToken
but sinceremoveCookie
is also used for other cookies I movedTokenStateManager#deleteTokens
call out of it into a dedicatedremoveSessionCookie
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