-
Notifications
You must be signed in to change notification settings - Fork 41.4k
Description
When I recently upgraded an application from spring boot 2.2.0.M6 to 2.2.0.RC1 that uses both OAuth2 Resource Server (opaque token support) and OAuth2 Client, I found that the OAuth2 Resource Server opaque token auto configuration is no longer applied. So this appears to be a change/regression from 2.2.0.M6 -> 2.2.0.RC1
In 2.2.0.M6, I see the following in the autoconfiguration report, indicating a successful configuration of the opaque token support:
ReactiveOAuth2ResourceServerOpaqueTokenConfiguration.WebSecurityConfiguration matched:
- @ConditionalOnBean (types: org.springframework.security.web.server.SecurityWebFilterChain; SearchStrategy: all) did not find any beans (OnBeanCondition)
ReactiveOAuth2ResourceServerOpaqueTokenConfiguration.WebSecurityConfiguration#springSecurityFilterChain matched:
- @ConditionalOnBean (types: org.springframework.security.oauth2.server.resource.introspection.ReactiveOpaqueTokenIntrospector; SearchStrategy: all) found bean 'opaqueTokenIntrospector' (OnBeanCondition)
In 2.2.0.RC1, I see the following in the autoconfiguration report:
ReactiveOAuth2ResourceServerOpaqueTokenConfiguration.WebSecurityConfiguration:
Did not match:
- @ConditionalOnBean (types: org.springframework.security.web.server.SecurityWebFilterChain; SearchStrategy: all) found beans of type 'org.springframework.security.web.server.SecurityWebFilterChain' springSecurityFilterChain (OnBeanCondition)
It appears that when the OAuth2 Client AutoConfiguration executes, it defines a SecurityWebFilterChain, which prevents the ReactiveOAuth2ResourceServerOpaqueTokenConfiguration.WebSecurityConfiguration from applying.
If I remove the OAuth2 Client configuration properties, the Resource Server is configured properly.
Here is an example project with a unit test that shows the behavior. The test fails when using 2.2.0.RC1, but if you change the spring boot version to 2.2.0.M6, the test will pass.