Search in sources :

Example 26 with ServerWebExchangeMatcher

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

the class EndpointRequestTests method toAnyEndpointWhenBasePathIsEmptyShouldNotMatchLinks.

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

Example 27 with ServerWebExchangeMatcher

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

the class EndpointRequestTests method excludeByIdShouldNotMatchExcluded.

@Test
void excludeByIdShouldNotMatchExcluded() {
    ServerWebExchangeMatcher matcher = EndpointRequest.toAnyEndpoint().excluding("foo");
    assertMatcher(matcher).doesNotMatch("/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 28 with ServerWebExchangeMatcher

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

the class EndpointRequestTests method toEndpointIdShouldNotMatchOtherPath.

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

Example 29 with ServerWebExchangeMatcher

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

the class EndpointRequestTests method excludeByClassShouldNotMatchLinksIfExcluded.

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

Example 30 with ServerWebExchangeMatcher

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

the class StaticResourceRequestTests method atCommonLocationsShouldMatchCommonLocations.

@Test
void atCommonLocationsShouldMatchCommonLocations() {
    ServerWebExchangeMatcher matcher = this.resourceRequest.atCommonLocations();
    assertMatcher(matcher).matches("/css/file.css");
    assertMatcher(matcher).matches("/js/file.js");
    assertMatcher(matcher).matches("/images/file.css");
    assertMatcher(matcher).matches("/webjars/file.css");
    assertMatcher(matcher).matches("/favicon.ico");
    assertMatcher(matcher).matches("/favicon.png");
    assertMatcher(matcher).matches("/icons/icon-48x48.png");
    assertMatcher(matcher).doesNotMatch("/bar");
}
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