Update Opaque Token Client Name following upstream changes

Closes gh-17846
pull/17852/head
Madhura Bhave 5 years ago
parent c178c9dd47
commit 178746d678

@ -29,7 +29,7 @@ import org.springframework.security.config.annotation.web.reactive.EnableWebFlux
import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder; import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder;
import org.springframework.security.oauth2.server.resource.BearerTokenAuthenticationToken; import org.springframework.security.oauth2.server.resource.BearerTokenAuthenticationToken;
import org.springframework.security.oauth2.server.resource.authentication.OAuth2IntrospectionAuthenticationToken; import org.springframework.security.oauth2.server.resource.authentication.OAuth2IntrospectionAuthenticationToken;
import org.springframework.security.oauth2.server.resource.introspection.ReactiveOAuth2TokenIntrospectionClient; import org.springframework.security.oauth2.server.resource.introspection.ReactiveOpaqueTokenIntrospector;
/** /**
* {@link EnableAutoConfiguration Auto-configuration} for Reactive OAuth2 resource server * {@link EnableAutoConfiguration Auto-configuration} for Reactive OAuth2 resource server
@ -54,7 +54,7 @@ public class ReactiveOAuth2ResourceServerAutoConfiguration {
} }
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ OAuth2IntrospectionAuthenticationToken.class, ReactiveOAuth2TokenIntrospectionClient.class }) @ConditionalOnClass({ OAuth2IntrospectionAuthenticationToken.class, ReactiveOpaqueTokenIntrospector.class })
@Import({ ReactiveOAuth2ResourceServerOpaqueTokenConfiguration.OpaqueTokenIntrospectionClientConfiguration.class, @Import({ ReactiveOAuth2ResourceServerOpaqueTokenConfiguration.OpaqueTokenIntrospectionClientConfiguration.class,
ReactiveOAuth2ResourceServerOpaqueTokenConfiguration.WebSecurityConfiguration.class }) ReactiveOAuth2ResourceServerOpaqueTokenConfiguration.WebSecurityConfiguration.class })
static class OpaqueTokenConfiguration { static class OpaqueTokenConfiguration {

@ -24,29 +24,28 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.web.server.ServerHttpSecurity; import org.springframework.security.config.web.server.ServerHttpSecurity;
import org.springframework.security.config.web.server.ServerHttpSecurity.OAuth2ResourceServerSpec; import org.springframework.security.config.web.server.ServerHttpSecurity.OAuth2ResourceServerSpec;
import org.springframework.security.oauth2.server.resource.introspection.NimbusReactiveOAuth2TokenIntrospectionClient; import org.springframework.security.oauth2.server.resource.introspection.NimbusReactiveOpaqueTokenIntrospector;
import org.springframework.security.oauth2.server.resource.introspection.ReactiveOAuth2TokenIntrospectionClient; import org.springframework.security.oauth2.server.resource.introspection.ReactiveOpaqueTokenIntrospector;
import org.springframework.security.web.server.SecurityWebFilterChain; import org.springframework.security.web.server.SecurityWebFilterChain;
/** /**
* Configures a {@link ReactiveOAuth2TokenIntrospectionClient} when a token introspection * Configures a {@link ReactiveOpaqueTokenIntrospector} when a token introspection
* endpoint is available. Also configures a {@link SecurityWebFilterChain} if a * endpoint is available. Also configures a {@link SecurityWebFilterChain} if a
* {@link ReactiveOAuth2TokenIntrospectionClient} bean is found. * {@link ReactiveOpaqueTokenIntrospector} bean is found.
* *
* @author Madhura Bhave * @author Madhura Bhave
*/ */
class ReactiveOAuth2ResourceServerOpaqueTokenConfiguration { class ReactiveOAuth2ResourceServerOpaqueTokenConfiguration {
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnMissingBean(ReactiveOAuth2TokenIntrospectionClient.class) @ConditionalOnMissingBean(ReactiveOpaqueTokenIntrospector.class)
static class OpaqueTokenIntrospectionClientConfiguration { static class OpaqueTokenIntrospectionClientConfiguration {
@Bean @Bean
@ConditionalOnProperty(name = "spring.security.oauth2.resourceserver.opaquetoken.introspection-uri") @ConditionalOnProperty(name = "spring.security.oauth2.resourceserver.opaquetoken.introspection-uri")
NimbusReactiveOAuth2TokenIntrospectionClient oAuth2TokenIntrospectionClient( NimbusReactiveOpaqueTokenIntrospector opaqueTokenIntrospector(OAuth2ResourceServerProperties properties) {
OAuth2ResourceServerProperties properties) {
OAuth2ResourceServerProperties.Opaquetoken opaqueToken = properties.getOpaquetoken(); OAuth2ResourceServerProperties.Opaquetoken opaqueToken = properties.getOpaquetoken();
return new NimbusReactiveOAuth2TokenIntrospectionClient(opaqueToken.getIntrospectionUri(), return new NimbusReactiveOpaqueTokenIntrospector(opaqueToken.getIntrospectionUri(),
opaqueToken.getClientId(), opaqueToken.getClientSecret()); opaqueToken.getClientId(), opaqueToken.getClientSecret());
} }
@ -57,7 +56,7 @@ class ReactiveOAuth2ResourceServerOpaqueTokenConfiguration {
static class WebSecurityConfiguration { static class WebSecurityConfiguration {
@Bean @Bean
@ConditionalOnBean(ReactiveOAuth2TokenIntrospectionClient.class) @ConditionalOnBean(ReactiveOpaqueTokenIntrospector.class)
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) { SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
http.authorizeExchange((exchanges) -> exchanges.anyExchange().authenticated()); http.authorizeExchange((exchanges) -> exchanges.anyExchange().authenticated());
http.oauth2ResourceServer(OAuth2ResourceServerSpec::opaqueToken); http.oauth2ResourceServer(OAuth2ResourceServerSpec::opaqueToken);

@ -28,7 +28,7 @@ import org.springframework.context.annotation.Import;
import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationToken; import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationToken;
import org.springframework.security.oauth2.server.resource.authentication.OAuth2IntrospectionAuthenticationToken; import org.springframework.security.oauth2.server.resource.authentication.OAuth2IntrospectionAuthenticationToken;
import org.springframework.security.oauth2.server.resource.introspection.OAuth2TokenIntrospectionClient; import org.springframework.security.oauth2.server.resource.introspection.OpaqueTokenIntrospector;
/** /**
* {@link EnableAutoConfiguration Auto-configuration} for OAuth2 resource server support. * {@link EnableAutoConfiguration Auto-configuration} for OAuth2 resource server support.
@ -52,7 +52,7 @@ public class OAuth2ResourceServerAutoConfiguration {
} }
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ OAuth2IntrospectionAuthenticationToken.class, OAuth2TokenIntrospectionClient.class }) @ConditionalOnClass({ OAuth2IntrospectionAuthenticationToken.class, OpaqueTokenIntrospector.class })
@Import({ OAuth2ResourceServerOpaqueTokenConfiguration.OpaqueTokenIntrospectionClientConfiguration.class, @Import({ OAuth2ResourceServerOpaqueTokenConfiguration.OpaqueTokenIntrospectionClientConfiguration.class,
OAuth2ResourceServerOpaqueTokenConfiguration.OAuth2WebSecurityConfigurerAdapter.class }) OAuth2ResourceServerOpaqueTokenConfiguration.OAuth2WebSecurityConfigurerAdapter.class })
static class OpaqueTokenConfiguration { static class OpaqueTokenConfiguration {

@ -24,13 +24,13 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer; import org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer;
import org.springframework.security.oauth2.server.resource.introspection.NimbusOAuth2TokenIntrospectionClient; import org.springframework.security.oauth2.server.resource.introspection.NimbusOpaqueTokenIntrospector;
import org.springframework.security.oauth2.server.resource.introspection.OAuth2TokenIntrospectionClient; import org.springframework.security.oauth2.server.resource.introspection.OpaqueTokenIntrospector;
/** /**
* Configures a {@link OAuth2TokenIntrospectionClient} when a token introspection endpoint * Configures a {@link OpaqueTokenIntrospector} when a token introspection endpoint is
* is available. Also configures a {@link WebSecurityConfigurerAdapter} if a * available. Also configures a {@link WebSecurityConfigurerAdapter} if a
* {@link OAuth2TokenIntrospectionClient} bean is found. * {@link OpaqueTokenIntrospector} bean is found.
* *
* @author Madhura Bhave * @author Madhura Bhave
*/ */
@ -38,15 +38,15 @@ import org.springframework.security.oauth2.server.resource.introspection.OAuth2T
class OAuth2ResourceServerOpaqueTokenConfiguration { class OAuth2ResourceServerOpaqueTokenConfiguration {
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnMissingBean(OAuth2TokenIntrospectionClient.class) @ConditionalOnMissingBean(OpaqueTokenIntrospector.class)
static class OpaqueTokenIntrospectionClientConfiguration { static class OpaqueTokenIntrospectionClientConfiguration {
@Bean @Bean
@ConditionalOnProperty(name = "spring.security.oauth2.resourceserver.opaquetoken.introspection-uri") @ConditionalOnProperty(name = "spring.security.oauth2.resourceserver.opaquetoken.introspection-uri")
NimbusOAuth2TokenIntrospectionClient oAuth2TokenIntrospectionClient(OAuth2ResourceServerProperties properties) { NimbusOpaqueTokenIntrospector opaqueTokenIntrospector(OAuth2ResourceServerProperties properties) {
OAuth2ResourceServerProperties.Opaquetoken opaqueToken = properties.getOpaquetoken(); OAuth2ResourceServerProperties.Opaquetoken opaqueToken = properties.getOpaquetoken();
return new NimbusOAuth2TokenIntrospectionClient(opaqueToken.getIntrospectionUri(), return new NimbusOpaqueTokenIntrospector(opaqueToken.getIntrospectionUri(), opaqueToken.getClientId(),
opaqueToken.getClientId(), opaqueToken.getClientSecret()); opaqueToken.getClientSecret());
} }
} }
@ -56,7 +56,7 @@ class OAuth2ResourceServerOpaqueTokenConfiguration {
static class OAuth2WebSecurityConfigurerAdapter { static class OAuth2WebSecurityConfigurerAdapter {
@Bean @Bean
@ConditionalOnBean(OAuth2TokenIntrospectionClient.class) @ConditionalOnBean(OpaqueTokenIntrospector.class)
WebSecurityConfigurerAdapter opaqueTokenWebSecurityConfigurerAdapter() { WebSecurityConfigurerAdapter opaqueTokenWebSecurityConfigurerAdapter() {
return new WebSecurityConfigurerAdapter() { return new WebSecurityConfigurerAdapter() {

@ -48,9 +48,9 @@ import org.springframework.util.StringUtils;
*/ */
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ ReactiveAuthenticationManager.class }) @ConditionalOnClass({ ReactiveAuthenticationManager.class })
@ConditionalOnMissingBean(value = { ReactiveAuthenticationManager.class, ReactiveUserDetailsService.class }, type = { @ConditionalOnMissingBean(value = { ReactiveAuthenticationManager.class, ReactiveUserDetailsService.class },
"org.springframework.security.oauth2.jwt.ReactiveJwtDecoder", type = { "org.springframework.security.oauth2.jwt.ReactiveJwtDecoder",
"org.springframework.security.oauth2.server.resource.introspection.ReactiveOAuth2TokenIntrospectionClient" }) "org.springframework.security.oauth2.server.resource.introspection.ReactiveOpaqueTokenIntrospector" })
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE) @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
public class ReactiveUserDetailsServiceAutoConfiguration { public class ReactiveUserDetailsServiceAutoConfiguration {

@ -58,7 +58,7 @@ import org.springframework.util.StringUtils;
@ConditionalOnMissingBean( @ConditionalOnMissingBean(
value = { AuthenticationManager.class, AuthenticationProvider.class, UserDetailsService.class }, value = { AuthenticationManager.class, AuthenticationProvider.class, UserDetailsService.class },
type = { "org.springframework.security.oauth2.jwt.JwtDecoder", type = { "org.springframework.security.oauth2.jwt.JwtDecoder",
"org.springframework.security.oauth2.server.resource.introspection.OAuth2TokenIntrospectionClient" }) "org.springframework.security.oauth2.server.resource.introspection.OpaqueTokenIntrospector" })
public class UserDetailsServiceAutoConfiguration { public class UserDetailsServiceAutoConfiguration {
private static final String NOOP_PASSWORD_PREFIX = "{noop}"; private static final String NOOP_PASSWORD_PREFIX = "{noop}";

@ -48,8 +48,7 @@ import org.springframework.security.oauth2.server.resource.BearerTokenAuthentica
import org.springframework.security.oauth2.server.resource.authentication.JwtReactiveAuthenticationManager; import org.springframework.security.oauth2.server.resource.authentication.JwtReactiveAuthenticationManager;
import org.springframework.security.oauth2.server.resource.authentication.OAuth2IntrospectionAuthenticationToken; import org.springframework.security.oauth2.server.resource.authentication.OAuth2IntrospectionAuthenticationToken;
import org.springframework.security.oauth2.server.resource.authentication.OAuth2IntrospectionReactiveAuthenticationManager; import org.springframework.security.oauth2.server.resource.authentication.OAuth2IntrospectionReactiveAuthenticationManager;
import org.springframework.security.oauth2.server.resource.introspection.OAuth2TokenIntrospectionClient; import org.springframework.security.oauth2.server.resource.introspection.ReactiveOpaqueTokenIntrospector;
import org.springframework.security.oauth2.server.resource.introspection.ReactiveOAuth2TokenIntrospectionClient;
import org.springframework.security.web.server.MatcherSecurityWebFilterChain; import org.springframework.security.web.server.MatcherSecurityWebFilterChain;
import org.springframework.security.web.server.SecurityWebFilterChain; import org.springframework.security.web.server.SecurityWebFilterChain;
import org.springframework.security.web.server.authentication.AuthenticationWebFilter; import org.springframework.security.web.server.authentication.AuthenticationWebFilter;
@ -252,17 +251,17 @@ class ReactiveOAuth2ResourceServerAutoConfigurationTests {
"spring.security.oauth2.resourceserver.opaquetoken.client-id=my-client-id", "spring.security.oauth2.resourceserver.opaquetoken.client-id=my-client-id",
"spring.security.oauth2.resourceserver.opaquetoken.client-secret=my-client-secret") "spring.security.oauth2.resourceserver.opaquetoken.client-secret=my-client-secret")
.run((context) -> { .run((context) -> {
assertThat(context).hasSingleBean(ReactiveOAuth2TokenIntrospectionClient.class); assertThat(context).hasSingleBean(ReactiveOpaqueTokenIntrospector.class);
assertFilterConfiguredWithOpaqueTokenAuthenticationManager(context); assertFilterConfiguredWithOpaqueTokenAuthenticationManager(context);
}); });
} }
@Test @Test
void oAuth2TokenIntrospectionClientIsConditionalOnMissingBean() { void opaqueTokenIntrospectorIsConditionalOnMissingBean() {
this.contextRunner this.contextRunner
.withPropertyValues( .withPropertyValues(
"spring.security.oauth2.resourceserver.opaquetoken.introspection-uri=https://check-token.com") "spring.security.oauth2.resourceserver.opaquetoken.introspection-uri=https://check-token.com")
.withUserConfiguration(OAuth2TokenIntrospectionClientConfig.class) .withUserConfiguration(OpaqueTokenIntrospectorConfig.class)
.run((this::assertFilterConfiguredWithOpaqueTokenAuthenticationManager)); .run((this::assertFilterConfiguredWithOpaqueTokenAuthenticationManager));
} }
@ -286,7 +285,7 @@ class ReactiveOAuth2ResourceServerAutoConfigurationTests {
"spring.security.oauth2.resourceserver.opaquetoken.introspection-uri=https://check-token.com", "spring.security.oauth2.resourceserver.opaquetoken.introspection-uri=https://check-token.com",
"spring.security.oauth2.resourceserver.opaquetoken.client-id=my-client-id", "spring.security.oauth2.resourceserver.opaquetoken.client-id=my-client-id",
"spring.security.oauth2.resourceserver.opaquetoken.client-secret=my-client-secret") "spring.security.oauth2.resourceserver.opaquetoken.client-secret=my-client-secret")
.run((context) -> assertThat(context).doesNotHaveBean(OAuth2TokenIntrospectionClient.class)); .run((context) -> assertThat(context).doesNotHaveBean(ReactiveOpaqueTokenIntrospector.class));
} }
@Test @Test
@ -406,11 +405,11 @@ class ReactiveOAuth2ResourceServerAutoConfigurationTests {
} }
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
static class OAuth2TokenIntrospectionClientConfig { static class OpaqueTokenIntrospectorConfig {
@Bean @Bean
ReactiveOAuth2TokenIntrospectionClient decoder() { ReactiveOpaqueTokenIntrospector decoder() {
return mock(ReactiveOAuth2TokenIntrospectionClient.class); return mock(ReactiveOpaqueTokenIntrospector.class);
} }
} }

@ -44,7 +44,7 @@ import org.springframework.security.config.annotation.web.configuration.EnableWe
import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationToken; import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationToken;
import org.springframework.security.oauth2.server.resource.authentication.OAuth2IntrospectionAuthenticationToken; import org.springframework.security.oauth2.server.resource.authentication.OAuth2IntrospectionAuthenticationToken;
import org.springframework.security.oauth2.server.resource.introspection.OAuth2TokenIntrospectionClient; import org.springframework.security.oauth2.server.resource.introspection.OpaqueTokenIntrospector;
import org.springframework.security.oauth2.server.resource.web.BearerTokenAuthenticationFilter; import org.springframework.security.oauth2.server.resource.web.BearerTokenAuthenticationFilter;
import org.springframework.security.web.FilterChainProxy; import org.springframework.security.web.FilterChainProxy;
import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.SecurityFilterChain;
@ -266,17 +266,17 @@ class OAuth2ResourceServerAutoConfigurationTests {
"spring.security.oauth2.resourceserver.opaquetoken.client-id=my-client-id", "spring.security.oauth2.resourceserver.opaquetoken.client-id=my-client-id",
"spring.security.oauth2.resourceserver.opaquetoken.client-secret=my-client-secret") "spring.security.oauth2.resourceserver.opaquetoken.client-secret=my-client-secret")
.run((context) -> { .run((context) -> {
assertThat(context).hasSingleBean(OAuth2TokenIntrospectionClient.class); assertThat(context).hasSingleBean(OpaqueTokenIntrospector.class);
assertThat(getBearerTokenFilter(context)).isNotNull(); assertThat(getBearerTokenFilter(context)).isNotNull();
}); });
} }
@Test @Test
void oAuth2TokenIntrospectionClientIsConditionalOnMissingBean() { void opaqueTokenIntrospectorIsConditionalOnMissingBean() {
this.contextRunner this.contextRunner
.withPropertyValues( .withPropertyValues(
"spring.security.oauth2.resourceserver.opaquetoken.introspection-uri=https://check-token.com") "spring.security.oauth2.resourceserver.opaquetoken.introspection-uri=https://check-token.com")
.withUserConfiguration(OAuth2TokenIntrospectionClientConfig.class) .withUserConfiguration(OpaqueTokenIntrospectorConfig.class)
.run((context) -> assertThat(getBearerTokenFilter(context)).isNotNull()); .run((context) -> assertThat(getBearerTokenFilter(context)).isNotNull());
} }
@ -287,7 +287,7 @@ class OAuth2ResourceServerAutoConfigurationTests {
"spring.security.oauth2.resourceserver.opaquetoken.introspection-uri=https://check-token.com", "spring.security.oauth2.resourceserver.opaquetoken.introspection-uri=https://check-token.com",
"spring.security.oauth2.resourceserver.opaquetoken.client-id=my-client-id", "spring.security.oauth2.resourceserver.opaquetoken.client-id=my-client-id",
"spring.security.oauth2.resourceserver.opaquetoken.client-secret=my-client-secret") "spring.security.oauth2.resourceserver.opaquetoken.client-secret=my-client-secret")
.run((context) -> assertThat(context).doesNotHaveBean(OAuth2TokenIntrospectionClient.class)); .run((context) -> assertThat(context).doesNotHaveBean(OpaqueTokenIntrospector.class));
} }
@Test @Test
@ -387,11 +387,11 @@ class OAuth2ResourceServerAutoConfigurationTests {
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@EnableWebSecurity @EnableWebSecurity
static class OAuth2TokenIntrospectionClientConfig { static class OpaqueTokenIntrospectorConfig {
@Bean @Bean
OAuth2TokenIntrospectionClient decoder() { OpaqueTokenIntrospector decoder() {
return mock(OAuth2TokenIntrospectionClient.class); return mock(OpaqueTokenIntrospector.class);
} }
} }

@ -35,7 +35,7 @@ import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder; import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder;
import org.springframework.security.oauth2.server.resource.introspection.ReactiveOAuth2TokenIntrospectionClient; import org.springframework.security.oauth2.server.resource.introspection.ReactiveOpaqueTokenIntrospector;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
@ -86,9 +86,8 @@ class ReactiveUserDetailsServiceAutoConfigurationTests {
@Test @Test
void doesNotConfigureDefaultUserIfResourceServerWithOpaqueIsUsed() { void doesNotConfigureDefaultUserIfResourceServerWithOpaqueIsUsed() {
this.contextRunner.withUserConfiguration(ReactiveOAuth2TokenIntrospectionClientConfiguration.class) this.contextRunner.withUserConfiguration(ReactiveOpaqueTokenIntrospectorConfiguration.class).run((context) -> {
.run((context) -> { assertThat(context).hasSingleBean(ReactiveOpaqueTokenIntrospector.class);
assertThat(context).hasSingleBean(ReactiveOAuth2TokenIntrospectionClient.class);
assertThat(context).doesNotHaveBean(ReactiveUserDetailsService.class); assertThat(context).doesNotHaveBean(ReactiveUserDetailsService.class);
}); });
} }
@ -180,11 +179,11 @@ class ReactiveUserDetailsServiceAutoConfigurationTests {
} }
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
static class ReactiveOAuth2TokenIntrospectionClientConfiguration { static class ReactiveOpaqueTokenIntrospectorConfiguration {
@Bean @Bean
ReactiveOAuth2TokenIntrospectionClient introspectionClient() { ReactiveOpaqueTokenIntrospector introspectionClient() {
return mock(ReactiveOAuth2TokenIntrospectionClient.class); return mock(ReactiveOpaqueTokenIntrospector.class);
} }
} }

@ -43,7 +43,7 @@ import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository; import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.security.oauth2.server.resource.introspection.OAuth2TokenIntrospectionClient; import org.springframework.security.oauth2.server.resource.introspection.OpaqueTokenIntrospector;
import org.springframework.security.provisioning.InMemoryUserDetailsManager; import org.springframework.security.provisioning.InMemoryUserDetailsManager;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
@ -105,7 +105,7 @@ class UserDetailsServiceAutoConfigurationTests {
@Test @Test
void defaultUserNotCreatedIfResourceServerWithOpaqueIsUsed() { void defaultUserNotCreatedIfResourceServerWithOpaqueIsUsed() {
this.contextRunner.withUserConfiguration(TestConfigWithIntrospectionClient.class).run((context) -> { this.contextRunner.withUserConfiguration(TestConfigWithIntrospectionClient.class).run((context) -> {
assertThat(context).hasSingleBean(OAuth2TokenIntrospectionClient.class); assertThat(context).hasSingleBean(OpaqueTokenIntrospector.class);
assertThat(context).doesNotHaveBean(UserDetailsService.class); assertThat(context).doesNotHaveBean(UserDetailsService.class);
}); });
} }
@ -243,8 +243,8 @@ class UserDetailsServiceAutoConfigurationTests {
static class TestConfigWithIntrospectionClient { static class TestConfigWithIntrospectionClient {
@Bean @Bean
OAuth2TokenIntrospectionClient introspectionClient() { OpaqueTokenIntrospector introspectionClient() {
return mock(OAuth2TokenIntrospectionClient.class); return mock(OpaqueTokenIntrospector.class);
} }
} }

@ -191,7 +191,7 @@
<spring-plugin.version>2.0.0.M1</spring-plugin.version> <spring-plugin.version>2.0.0.M1</spring-plugin.version>
<spring-restdocs.version>2.0.3.RELEASE</spring-restdocs.version> <spring-restdocs.version>2.0.3.RELEASE</spring-restdocs.version>
<spring-retry.version>1.2.4.RELEASE</spring-retry.version> <spring-retry.version>1.2.4.RELEASE</spring-retry.version>
<spring-security.version>5.2.0.M4</spring-security.version> <spring-security.version>5.2.0.BUILD-SNAPSHOT</spring-security.version>
<spring-session-bom.version>Corn-M3</spring-session-bom.version> <spring-session-bom.version>Corn-M3</spring-session-bom.version>
<spring-ws.version>3.0.7.RELEASE</spring-ws.version> <spring-ws.version>3.0.7.RELEASE</spring-ws.version>
<sqlite-jdbc.version>3.28.0</sqlite-jdbc.version> <sqlite-jdbc.version>3.28.0</sqlite-jdbc.version>

@ -3805,8 +3805,8 @@ to validate tokens via introspection:
Again, the same properties are applicable for both servlet and reactive applications. Again, the same properties are applicable for both servlet and reactive applications.
Alternatively, you can define your own `OAuth2TokenIntrospectionClient` bean for servlet applications Alternatively, you can define your own `OpaqueTokenIntrospector` bean for servlet applications
or a `ReactiveOAuth2TokenIntrospectionClient` for reactive applications. or a `ReactiveOpaqueTokenIntrospector` for reactive applications.
==== Authorization Server ==== Authorization Server
Currently, Spring Security does not provide support for implementing an OAuth 2.0 Currently, Spring Security does not provide support for implementing an OAuth 2.0

Loading…
Cancel
Save