-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Consider removing GatewayReactiveOAuth2AutoConfiguration
#3493
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
Comments
I should mention, I have not yet checked to see if a similar issue exists for MVC gateway. |
@spencergibb any thoughts on this one? |
I think it sounds good. |
Thanks. Do we also have a similar issue on the MVC gateway? |
@spencergibb I opened gh-3528 to remove the auto-config. I did not find any auto-configuration for the mvc gateway. As a side note, I would also like to work on equivalent support for providing a custom |
Uh oh!
There was an error while loading. Please reload this page.
Expected Behavior
In Spring Security 6.3, we simplified configuration by introducing a new
BeanDefinitionRegistryPostProcessor
to register aReactiveOAuth2AuthorizedClientManager
bean if one is not already present.Note that we aren't using
@Conditional...
annotations to register this bean since we don't depend on Spring Boot, and without@AutoConfigureAfter
ordering would be an issue.When both Spring Security and Spring Cloud Gateway are on the classpath with the
TokenRelay
filter in use, the reactive gateway'sGatewayReactiveOAuth2AutoConfiguration
registers aReactiveOAuth2AuthorizedClientManager
which prevents the one provided by Spring Security from being registered. Given the new feature in 6.3, I think we can remove the auto-configuration in reactive gateway and allow Spring Security to provide the bean during post-processing.Additional context
I noticed this when working on a sample to enable the new Token Exchange feature in an OAuth2 Client that is using reactive Spring Cloud Gateway. With the new feature, I expect to be able to register the following bean:
and have this picked up by Spring Security and wired into the default instance of
ReactiveOAuth2AuthorizedClientManager
, thus enabling the Token Exchange grant type. Instead, it isn't picked up and the token exchange flow fails due to missing support for the Token Exchange grant type.To use Spring Security's provided
ReactiveOAuth2AuthorizedClientManager
(as a workaround), applications can include:However, this isn't straight-forward and requires some advanced knowledge to troubleshoot why Spring Security's default isn't being provided.
Alternatively, applications can register their own
ReactiveOAuth2AuthorizedClientManager
bean to override auto-configuration. This isn't ideal since the solution isn't able to take advantage of the simplified configuration feature in Spring Security.Note: I can make the sample repository available shortly if a reproducer is needed.
The text was updated successfully, but these errors were encountered: