use of org.springframework.security.web.util.matcher.RequestMatcher in project spring-boot by spring-projects.
the class EndpointRequestTests method excludeByClassShouldNotMatchExcluded.
@Test
void excludeByClassShouldNotMatchExcluded() {
RequestMatcher 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.util.matcher.RequestMatcher in project spring-boot by spring-projects.
the class EndpointRequestTests method toEndpointClassShouldNotMatchOtherPath.
@Test
void toEndpointClassShouldNotMatchOtherPath() {
RequestMatcher matcher = EndpointRequest.to(FooEndpoint.class);
assertMatcher(matcher).doesNotMatch("/actuator/bar");
assertMatcher(matcher).doesNotMatch("/actuator");
}
use of org.springframework.security.web.util.matcher.RequestMatcher in project spring-boot by spring-projects.
the class EndpointRequestTests method toAnyEndpointShouldMatchEndpointPath.
@Test
void toAnyEndpointShouldMatchEndpointPath() {
RequestMatcher matcher = EndpointRequest.toAnyEndpoint();
assertMatcher(matcher, "/actuator").matches("/actuator/foo");
assertMatcher(matcher, "/actuator").matches("/actuator/foo/zoo/");
assertMatcher(matcher, "/actuator").matches("/actuator/bar");
assertMatcher(matcher, "/actuator").matches("/actuator/bar/baz");
assertMatcher(matcher, "/actuator").matches("/actuator");
}
use of org.springframework.security.web.util.matcher.RequestMatcher in project spring-boot by spring-projects.
the class EndpointRequestTests method excludeByIdShouldNotMatchLinksIfExcluded.
@Test
void excludeByIdShouldNotMatchLinksIfExcluded() {
RequestMatcher matcher = EndpointRequest.toAnyEndpoint().excludingLinks().excluding("foo");
assertMatcher(matcher).doesNotMatch("/actuator/foo");
assertMatcher(matcher).doesNotMatch("/actuator");
}
use of org.springframework.security.web.util.matcher.RequestMatcher in project spring-boot by spring-projects.
the class EndpointRequestTests method excludeLinksShouldNotMatchBasePathIfEmptyAndExcluded.
@Test
void excludeLinksShouldNotMatchBasePathIfEmptyAndExcluded() {
RequestMatcher matcher = EndpointRequest.toAnyEndpoint().excludingLinks();
RequestMatcherAssert assertMatcher = assertMatcher(matcher, "");
assertMatcher.doesNotMatch("/");
assertMatcher.matches("/foo");
assertMatcher.matches("/bar");
}
Aggregations