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