From 35d7bb7f340671f2decd98d4623b7adfddb82ad2 Mon Sep 17 00:00:00 2001 From: Madhura Bhave Date: Mon, 27 Aug 2018 14:09:48 -0700 Subject: [PATCH] Polish "issuer uri in reactive resource-server config" Closes gh-14199 --- ...2ResourceServerAutoConfigurationTests.java | 32 +------------------ 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerAutoConfigurationTests.java index d4334a76336..bcca68b1519 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerAutoConfigurationTests.java @@ -136,7 +136,7 @@ public class ReactiveOAuth2ResourceServerAutoConfigurationTests { } @Test - public void jwtDecoderBeanIsConditionalOnMissingBeanUsingOidcIssuerUri() { + public void jwtDecoderByIssuerUriBeanIsConditionalOnMissingBean() { this.contextRunner.withPropertyValues( "spring.security.oauth2.resourceserver.jwt.issuer-uri=http://jwk-oidc-issuer-location.com") .withUserConfiguration(JwtDecoderConfig.class) @@ -154,17 +154,6 @@ public class ReactiveOAuth2ResourceServerAutoConfigurationTests { .doesNotHaveBean(BeanIds.SPRING_SECURITY_FILTER_CHAIN)); } - @Test - public void autoConfigurationShouldBeConditionalOnBearerTokenAuthenticationTokenClassUsingOidcIssuerUri() { - this.contextRunner.withPropertyValues( - "spring.security.oauth2.resourceserver.jwt.issuer-uri=http://jwk-oidc-issuer-location.com") - .withUserConfiguration(JwtDecoderConfig.class) - .withClassLoader( - new FilteredClassLoader(BearerTokenAuthenticationToken.class)) - .run((context) -> assertThat(context) - .doesNotHaveBean(BeanIds.SPRING_SECURITY_FILTER_CHAIN)); - } - @Test public void autoConfigurationWhenSecurityWebFilterChainConfigPresentShouldNotAddOne() { this.contextRunner.withPropertyValues( @@ -176,25 +165,6 @@ public class ReactiveOAuth2ResourceServerAutoConfigurationTests { }); } - @Test - public void autoConfigurationWhenSecurityWebFilterChainConfigPresentShouldNotAddOneUsingOidcIssuerUri() - throws IOException { - this.server = new MockWebServer(); - this.server.start(); - String issuer = this.server.url("").toString(); - String cleanIssuerPath = cleanIssuerPath(issuer); - setupMockResponse(cleanIssuerPath); - this.contextRunner - .withPropertyValues( - "spring.security.oauth2.resourceserver.jwt.issuer-uri=http://" - + this.server.getHostName() + ":" + this.server.getPort()) - .withUserConfiguration(SecurityWebFilterChainConfig.class) - .run((context) -> { - assertThat(context).hasSingleBean(SecurityWebFilterChain.class); - assertThat(context).hasBean("testSpringSecurityFilterChain"); - }); - } - @SuppressWarnings("unchecked") private void assertFilterConfiguredWithJwtAuthenticationManager( AssertableReactiveWebApplicationContext context) {