use of org.springframework.security.web.util.matcher.RequestMatcher in project spring-boot by spring-projects.
the class EndpointRequestTests method endpointRequestMatcherShouldUseCustomRequestMatcherProvider.
@Test
void endpointRequestMatcherShouldUseCustomRequestMatcherProvider() {
RequestMatcher matcher = EndpointRequest.toAnyEndpoint();
RequestMatcher mockRequestMatcher = (request) -> false;
RequestMatcherAssert assertMatcher = assertMatcher(matcher, mockPathMappedEndpoints(""), (pattern) -> mockRequestMatcher);
assertMatcher.doesNotMatch("/foo");
assertMatcher.doesNotMatch("/bar");
}
use of org.springframework.security.web.util.matcher.RequestMatcher in project spring-boot by spring-projects.
the class EndpointRequestTests method toEndpointIdShouldNotMatchOtherPath.
@Test
void toEndpointIdShouldNotMatchOtherPath() {
RequestMatcher matcher = EndpointRequest.to("foo");
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 toAnyEndpointWhenBasePathIsEmptyShouldNotMatchLinks.
@Test
void toAnyEndpointWhenBasePathIsEmptyShouldNotMatchLinks() {
RequestMatcher matcher = EndpointRequest.toAnyEndpoint();
RequestMatcherAssert assertMatcher = assertMatcher(matcher, "");
assertMatcher.doesNotMatch("/");
assertMatcher.matches("/foo");
assertMatcher.matches("/bar");
}
use of org.springframework.security.web.util.matcher.RequestMatcher in project spring-boot by spring-projects.
the class EndpointRequestTests method toAnyEndpointShouldNotMatchOtherPath.
@Test
void toAnyEndpointShouldNotMatchOtherPath() {
RequestMatcher matcher = EndpointRequest.toAnyEndpoint();
assertMatcher(matcher).doesNotMatch("/actuator/baz");
}
use of org.springframework.security.web.util.matcher.RequestMatcher in project spring-boot by spring-projects.
the class EndpointRequestTests method toAnyEndpointShouldMatchEndpointPathWithTrailingSlash.
@Test
void toAnyEndpointShouldMatchEndpointPathWithTrailingSlash() {
RequestMatcher matcher = EndpointRequest.toAnyEndpoint();
assertMatcher(matcher, "/actuator").matches("/actuator/foo/");
assertMatcher(matcher, "/actuator").matches("/actuator/bar/");
assertMatcher(matcher, "/actuator").matches("/actuator/");
}
Aggregations