parent
f0ed2a8e4c
commit
1b5fc89b43
|
@ -175,13 +175,13 @@ public class ReactiveCloudFoundryActuatorAutoConfiguration {
|
||||||
@Override
|
@Override
|
||||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||||
if (bean instanceof WebFilterChainProxy webFilterChainProxy) {
|
if (bean instanceof WebFilterChainProxy webFilterChainProxy) {
|
||||||
return postProcess(webFilterChainProxy, this.pathMappedEndpoints.get());
|
return postProcess(webFilterChainProxy);
|
||||||
}
|
}
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
|
||||||
private WebFilterChainProxy postProcess(WebFilterChainProxy existing, PathMappedEndpoints pathMappedEndpoints) {
|
private WebFilterChainProxy postProcess(WebFilterChainProxy existing) {
|
||||||
List<String> paths = getPaths(pathMappedEndpoints);
|
List<String> paths = getPaths(this.pathMappedEndpoints.get());
|
||||||
ServerWebExchangeMatcher cloudFoundryRequestMatcher = ServerWebExchangeMatchers
|
ServerWebExchangeMatcher cloudFoundryRequestMatcher = ServerWebExchangeMatchers
|
||||||
.pathMatchers(paths.toArray(new String[] {}));
|
.pathMatchers(paths.toArray(new String[] {}));
|
||||||
WebFilter noOpFilter = (exchange, chain) -> chain.filter(exchange);
|
WebFilter noOpFilter = (exchange, chain) -> chain.filter(exchange);
|
||||||
|
|
|
@ -205,10 +205,9 @@ class ReactiveCloudFoundryActuatorAutoConfigurationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Boolean getMatches(List<SecurityWebFilterChain> filters, String urlTemplate) {
|
private static Boolean getMatches(List<SecurityWebFilterChain> filters, String urlTemplate) {
|
||||||
Boolean cfBaseRequestMatches = filters.get(0)
|
return filters.get(0)
|
||||||
.matches(MockServerWebExchange.from(MockServerHttpRequest.get(urlTemplate).build()))
|
.matches(MockServerWebExchange.from(MockServerHttpRequest.get(urlTemplate).build()))
|
||||||
.block(Duration.ofSeconds(30));
|
.block(Duration.ofSeconds(30));
|
||||||
return cfBaseRequestMatches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -69,6 +69,8 @@ class CloudFoundryActuatorAutoConfigurationTests {
|
||||||
|
|
||||||
private static final String V3_JSON = ApiVersion.V3.getProducedMimeType().toString();
|
private static final String V3_JSON = ApiVersion.V3.getProducedMimeType().toString();
|
||||||
|
|
||||||
|
private static final String BASE_PATH = "/cloudfoundryapplication";
|
||||||
|
|
||||||
private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner()
|
private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner()
|
||||||
.withConfiguration(AutoConfigurations.of(SecurityAutoConfiguration.class, WebMvcAutoConfiguration.class,
|
.withConfiguration(AutoConfigurations.of(SecurityAutoConfiguration.class, WebMvcAutoConfiguration.class,
|
||||||
JacksonAutoConfiguration.class, DispatcherServletAutoConfiguration.class,
|
JacksonAutoConfiguration.class, DispatcherServletAutoConfiguration.class,
|
||||||
|
@ -77,8 +79,6 @@ class CloudFoundryActuatorAutoConfigurationTests {
|
||||||
ServletManagementContextAutoConfiguration.class, EndpointAutoConfiguration.class,
|
ServletManagementContextAutoConfiguration.class, EndpointAutoConfiguration.class,
|
||||||
WebEndpointAutoConfiguration.class, CloudFoundryActuatorAutoConfiguration.class));
|
WebEndpointAutoConfiguration.class, CloudFoundryActuatorAutoConfiguration.class));
|
||||||
|
|
||||||
private static String BASE_PATH = "/cloudfoundryapplication";
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void cloudFoundryPlatformActive() {
|
void cloudFoundryPlatformActive() {
|
||||||
this.contextRunner
|
this.contextRunner
|
||||||
|
@ -189,9 +189,9 @@ class CloudFoundryActuatorAutoConfigurationTests {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void testCloudFoundrySecurity(MockHttpServletRequest request, String basePath,
|
private static void testCloudFoundrySecurity(MockHttpServletRequest request, String servletPath,
|
||||||
SecurityFilterChain chain) {
|
SecurityFilterChain chain) {
|
||||||
request.setServletPath(basePath);
|
request.setServletPath(servletPath);
|
||||||
assertThat(chain.matches(request)).isTrue();
|
assertThat(chain.matches(request)).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue