Search in sources :

Example 16 with ServerWebExchangeMatcher

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

the class EndpointRequestTests method excludeLinksShouldNotMatchBasePath.

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

Example 17 with ServerWebExchangeMatcher

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

the class EndpointRequestTests method toAnyEndpointShouldNotMatchOtherPath.

@Test
void toAnyEndpointShouldNotMatchOtherPath() {
    ServerWebExchangeMatcher matcher = EndpointRequest.toAnyEndpoint();
    assertMatcher(matcher).doesNotMatch("/actuator/baz");
}
Also used : ServerWebExchangeMatcher(org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher) Test(org.junit.jupiter.api.Test)

Example 18 with ServerWebExchangeMatcher

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

the class EndpointRequestTests method toAnyEndpointShouldMatchEndpointPathWithTrailingSlash.

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

Example 19 with ServerWebExchangeMatcher

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

the class EndpointRequestTests method toAnyEndpointShouldMatchEndpointPath.

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

Example 20 with ServerWebExchangeMatcher

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

the class StaticResourceRequestTests method atLocationShouldMatchLocation.

@Test
void atLocationShouldMatchLocation() {
    ServerWebExchangeMatcher matcher = this.resourceRequest.at(StaticResourceLocation.CSS);
    assertMatcher(matcher).matches("/css/file.css");
    assertMatcher(matcher).doesNotMatch("/js/file.js");
}
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