-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
DefaultReactiveOAuth2AuthorizedClientManager never calls UnAuthenticatedServerOAuth2AuthorizedClientRepository #7544
Comments
It seems related but I believe it to be not the same. If the Mono returned from Line 107 in 6ad328f
is empty the whole Lines 108 to 111 in 6ad328f
It might make sense to |
For further context: I'm using the OAuth2 support in the WebClient outside the context of a WebFlux application and requests I'm doing are not related to the SecurityContext associated with a web user. This also seems to be the scope/usecase for the |
@frzme I see that you need to use it outside of a request context. We do have a new implementation introduced in 5.2.0, Does this help? |
I believe that would help! I have no issues using a different ClientManager, it however was unexpected to me during migration to 5.2.0 that that would be necessary. Will you be providing such a reactive |
No it wouldn't be. As mentioned,
With the introduction of |
@frzme I'm going to close this issue and associated PR since |
Thank you and sorry for being unresponsive. I think it is rather unfortunate that this exact behavior which worked in the previous version of spring security (and there were also examples doing just this) is now now "broken-as-designed". It also fails transparently - for users it looks like it might be working, it's just re-requesting oauth tokens with every request, which makes it rather hard to spot this. I'm however fine with a natively supported alternate configuration. I see that someone has already provided one in the linked Issue, I'm happy about that and hope it can become part of spring-security 5.2.2. |
@frzme I'm re-opening and will address this in 5.2.x. My initial analysis was incorrect. Existing applications using |
…nticatedServerOAuth2AuthorizedClientRepository Fixes gh-7544
Summary
When using
UnAuthenticatedServerOAuth2AuthorizedClientRepository
together with theDefaultReactiveOAuth2AuthorizedClientManager
authorized clients are not correctly loaded/saved.This seems to relate to #7468 (@jgrandja )
It seems that when using the
UnAuthenticatedServerOAuth2AuthorizedClientRepository
it is (and can) never be called fromDefaultReactiveOAuth2AuthorizedClientManager
as it tries toflatMap
aMono<ServerWebExchange
(in the methodloadAuthorizedClient
). In situations thereUnAuthenticatedServerOAuth2AuthorizedClientRepository
can/should be used the WebExchange well be null/empty theMono
will be empty and therefore the code inflatMap
will not execute.If
ServerWebExchange
would be presentUnAuthenticatedServerOAuth2AuthorizedClientRepository
would throw an Exception there therefore needs to be a way for the ClientManager to call the repository without a WebExchange.Version
Spring Security 5.2.0 via Spring Boot 2.2.0
The text was updated successfully, but these errors were encountered: