use of org.springframework.boot.test.context.assertj.AssertableReactiveWebApplicationContext in project spring-boot by spring-projects.
the class ReactiveManagementWebSecurityAutoConfigurationTests method performFilter.
private ServerWebExchange performFilter(AssertableReactiveWebApplicationContext context, String path) {
ServerWebExchange exchange = webHandler(context).createExchange(MockServerHttpRequest.get(path).build(), new MockServerHttpResponse());
WebFilterChainProxy proxy = context.getBean(WebFilterChainProxy.class);
proxy.filter(exchange, (serverWebExchange) -> Mono.empty()).block(Duration.ofSeconds(30));
return exchange;
}
use of org.springframework.boot.test.context.assertj.AssertableReactiveWebApplicationContext in project spring-boot by spring-projects.
the class ReactiveOAuth2ResourceServerAutoConfigurationTests method assertFilterConfiguredWithJwtAuthenticationManager.
private void assertFilterConfiguredWithJwtAuthenticationManager(AssertableReactiveWebApplicationContext context) {
MatcherSecurityWebFilterChain filterChain = (MatcherSecurityWebFilterChain) context.getBean(BeanIds.SPRING_SECURITY_FILTER_CHAIN);
Stream<WebFilter> filters = filterChain.getWebFilters().toStream();
AuthenticationWebFilter webFilter = (AuthenticationWebFilter) filters.filter((f) -> f instanceof AuthenticationWebFilter).findFirst().orElse(null);
ReactiveAuthenticationManagerResolver<?> authenticationManagerResolver = (ReactiveAuthenticationManagerResolver<?>) ReflectionTestUtils.getField(webFilter, "authenticationManagerResolver");
Object authenticationManager = authenticationManagerResolver.resolve(null).block();
assertThat(authenticationManager).isInstanceOf(JwtReactiveAuthenticationManager.class);
}
use of org.springframework.boot.test.context.assertj.AssertableReactiveWebApplicationContext in project spring-boot by spring-projects.
the class ReactiveOAuth2ResourceServerAutoConfigurationTests method assertFilterConfiguredWithOpaqueTokenAuthenticationManager.
private void assertFilterConfiguredWithOpaqueTokenAuthenticationManager(AssertableReactiveWebApplicationContext context) {
MatcherSecurityWebFilterChain filterChain = (MatcherSecurityWebFilterChain) context.getBean(BeanIds.SPRING_SECURITY_FILTER_CHAIN);
Stream<WebFilter> filters = filterChain.getWebFilters().toStream();
AuthenticationWebFilter webFilter = (AuthenticationWebFilter) filters.filter((f) -> f instanceof AuthenticationWebFilter).findFirst().orElse(null);
ReactiveAuthenticationManagerResolver<?> authenticationManagerResolver = (ReactiveAuthenticationManagerResolver<?>) ReflectionTestUtils.getField(webFilter, "authenticationManagerResolver");
Object authenticationManager = authenticationManagerResolver.resolve(null).block();
assertThat(authenticationManager).isInstanceOf(OpaqueTokenReactiveAuthenticationManager.class);
}
Aggregations