From 0d2e44151b1cbb428ae5ac50ff7d9ac6c990071a Mon Sep 17 00:00:00 2001 From: Madhura Bhave Date: Thu, 13 Jun 2019 16:09:57 -0700 Subject: [PATCH] Fix tests following Spring Security changes --- ...veOAuth2ResourceServerAutoConfigurationTests.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 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 4bfa04c7c9..68f34729c7 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 @@ -37,7 +37,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; -import org.springframework.security.authentication.ReactiveAuthenticationManager; +import org.springframework.security.authentication.ReactiveAuthenticationManagerResolver; import org.springframework.security.config.BeanIds; import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; import org.springframework.security.config.web.server.ServerHttpSecurity; @@ -289,8 +289,9 @@ class ReactiveOAuth2ResourceServerAutoConfigurationTests { Stream filters = filterChain.getWebFilters().toStream(); AuthenticationWebFilter webFilter = (AuthenticationWebFilter) filters .filter((f) -> f instanceof AuthenticationWebFilter).findFirst().orElse(null); - ReactiveAuthenticationManager authenticationManager = (ReactiveAuthenticationManager) ReflectionTestUtils - .getField(webFilter, "authenticationManager"); + ReactiveAuthenticationManagerResolver authenticationManagerResolver = (ReactiveAuthenticationManagerResolver) ReflectionTestUtils + .getField(webFilter, "authenticationManagerResolver"); + Object authenticationManager = authenticationManagerResolver.resolve(null).block(); assertThat(authenticationManager).isInstanceOf(JwtReactiveAuthenticationManager.class); } @@ -301,8 +302,9 @@ class ReactiveOAuth2ResourceServerAutoConfigurationTests { Stream filters = filterChain.getWebFilters().toStream(); AuthenticationWebFilter webFilter = (AuthenticationWebFilter) filters .filter((f) -> f instanceof AuthenticationWebFilter).findFirst().orElse(null); - ReactiveAuthenticationManager authenticationManager = (ReactiveAuthenticationManager) ReflectionTestUtils - .getField(webFilter, "authenticationManager"); + ReactiveAuthenticationManagerResolver authenticationManagerResolver = (ReactiveAuthenticationManagerResolver) ReflectionTestUtils + .getField(webFilter, "authenticationManagerResolver"); + Object authenticationManager = authenticationManagerResolver.resolve(null).block(); assertThat(authenticationManager).isInstanceOf(OAuth2IntrospectionReactiveAuthenticationManager.class); }