Search in sources :

Example 11 with ServerWebExchangeMatcher

use of org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher in project spring-boot by spring-projects.

the class EndpointRequestTests method toEndpointIdShouldMatchEndpointPath.

@Test
void toEndpointIdShouldMatchEndpointPath() {
    ServerWebExchangeMatcher matcher = EndpointRequest.to("foo");
    assertMatcher(matcher).matches("/actuator/foo");
}
Also used : ServerWebExchangeMatcher(org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher) Test(org.junit.jupiter.api.Test)

Example 12 with ServerWebExchangeMatcher

use of org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher in project spring-boot by spring-projects.

the class EndpointRequestTests method toLinksWhenBasePathEmptyShouldNotMatch.

@Test
void toLinksWhenBasePathEmptyShouldNotMatch() {
    ServerWebExchangeMatcher matcher = EndpointRequest.toLinks();
    RequestMatcherAssert assertMatcher = assertMatcher(matcher, "");
    assertMatcher.doesNotMatch("/actuator/foo");
    assertMatcher.doesNotMatch("/actuator/bar");
    assertMatcher.doesNotMatch("/");
}
Also used : ServerWebExchangeMatcher(org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher) Test(org.junit.jupiter.api.Test)

Example 13 with ServerWebExchangeMatcher

use of org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher in project spring-boot by spring-projects.

the class EndpointRequestTests method noEndpointPathsBeansShouldNeverMatch.

@Test
void noEndpointPathsBeansShouldNeverMatch() {
    ServerWebExchangeMatcher matcher = EndpointRequest.toAnyEndpoint();
    assertMatcher(matcher, (PathMappedEndpoints) null).doesNotMatch("/actuator/foo");
    assertMatcher(matcher, (PathMappedEndpoints) null).doesNotMatch("/actuator/bar");
}
Also used : ServerWebExchangeMatcher(org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher) PathMappedEndpoints(org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints) Test(org.junit.jupiter.api.Test)

Example 14 with ServerWebExchangeMatcher

use of org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher in project spring-boot by spring-projects.

the class EndpointRequestTests method toEndpointClassShouldNotMatchOtherPath.

@Test
void toEndpointClassShouldNotMatchOtherPath() {
    ServerWebExchangeMatcher matcher = EndpointRequest.to(FooEndpoint.class);
    assertMatcher(matcher).doesNotMatch("/actuator/bar");
}
Also used : ServerWebExchangeMatcher(org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher) Test(org.junit.jupiter.api.Test)

Example 15 with ServerWebExchangeMatcher

use of org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher in project spring-boot by spring-projects.

the class EndpointRequestTests method toLinksShouldOnlyMatchLinks.

@Test
void toLinksShouldOnlyMatchLinks() {
    ServerWebExchangeMatcher matcher = EndpointRequest.toLinks();
    assertMatcher(matcher).doesNotMatch("/actuator/foo");
    assertMatcher(matcher).doesNotMatch("/actuator/bar");
    assertMatcher(matcher).matches("/actuator");
    assertMatcher(matcher).matches("/actuator/");
}
Also used : ServerWebExchangeMatcher(org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher) Test(org.junit.jupiter.api.Test)

Aggregations

ServerWebExchangeMatcher (org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher)38 Test (org.junit.jupiter.api.Test)35 MockServerWebExchange (org.springframework.mock.web.server.MockServerWebExchange)8 ServerWebExchange (org.springframework.web.server.ServerWebExchange)6 Collections (java.util.Collections)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)3 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)3 ArgumentMatchers.any (org.mockito.ArgumentMatchers.any)3 BDDMockito.given (org.mockito.BDDMockito.given)3 Mockito.mock (org.mockito.Mockito.mock)3 Mockito.spy (org.mockito.Mockito.spy)3 Mockito.verify (org.mockito.Mockito.verify)3 Answer (org.mockito.stubbing.Answer)3 WebDriver (org.openqa.selenium.WebDriver)3 Autowired (org.springframework.beans.factory.annotation.Autowired)3 ApplicationContext (org.springframework.context.ApplicationContext)3 Bean (org.springframework.context.annotation.Bean)3 Configuration (org.springframework.context.annotation.Configuration)3