use of org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher in project spring-boot by spring-projects.
the class StaticResourceRequestTests method atCommonLocationsWithExcludeShouldNotMatchExcluded.
@Test
void atCommonLocationsWithExcludeShouldNotMatchExcluded() {
ServerWebExchangeMatcher matcher = this.resourceRequest.atCommonLocations().excluding(StaticResourceLocation.CSS);
assertMatcher(matcher).doesNotMatch("/css/file.css");
assertMatcher(matcher).matches("/js/file.js");
}
use of org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher in project spring-boot by spring-projects.
the class EndpointRequestTests method excludeByClassShouldNotMatchExcluded.
@Test
void excludeByClassShouldNotMatchExcluded() {
ServerWebExchangeMatcher matcher = EndpointRequest.toAnyEndpoint().excluding(FooEndpoint.class, BazServletEndpoint.class);
List<ExposableEndpoint<?>> endpoints = new ArrayList<>();
endpoints.add(mockEndpoint(EndpointId.of("foo"), "foo"));
endpoints.add(mockEndpoint(EndpointId.of("bar"), "bar"));
endpoints.add(mockEndpoint(EndpointId.of("baz"), "baz"));
PathMappedEndpoints pathMappedEndpoints = new PathMappedEndpoints("/actuator", () -> endpoints);
assertMatcher(matcher, pathMappedEndpoints).doesNotMatch("/actuator/foo");
assertMatcher(matcher, pathMappedEndpoints).doesNotMatch("/actuator/baz");
assertMatcher(matcher).matches("/actuator/bar");
assertMatcher(matcher).matches("/actuator");
}
use of org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher in project spring-boot by spring-projects.
the class EndpointRequestTests method excludeByIdShouldNotMatchLinksIfExcluded.
@Test
void excludeByIdShouldNotMatchLinksIfExcluded() {
ServerWebExchangeMatcher matcher = EndpointRequest.toAnyEndpoint().excludingLinks().excluding("foo");
assertMatcher(matcher).doesNotMatch("/actuator/foo");
assertMatcher(matcher).doesNotMatch("/actuator");
}
use of org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher in project spring-boot by spring-projects.
the class EndpointRequestTests method excludeLinksShouldNotMatchBasePathIfEmptyAndExcluded.
@Test
void excludeLinksShouldNotMatchBasePathIfEmptyAndExcluded() {
ServerWebExchangeMatcher matcher = EndpointRequest.toAnyEndpoint().excludingLinks();
RequestMatcherAssert assertMatcher = assertMatcher(matcher, "");
assertMatcher.doesNotMatch("/");
assertMatcher.matches("/foo");
assertMatcher.matches("/bar");
}
use of org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher in project spring-boot by spring-projects.
the class EndpointRequestTests method toEndpointClassShouldMatchEndpointPath.
@Test
void toEndpointClassShouldMatchEndpointPath() {
ServerWebExchangeMatcher matcher = EndpointRequest.to(FooEndpoint.class);
assertMatcher(matcher).matches("/actuator/foo");
}
Aggregations