Search in sources :

Example 1 with AntPathRequestMatcherProvider

use of org.springframework.boot.autoconfigure.security.servlet.AntPathRequestMatcherProvider in project spring-boot by spring-projects.

the class SecurityRequestMatchersManagementContextConfigurationTests method registersRequestMatcherProviderIfMvcPresent.

@Test
void registersRequestMatcherProviderIfMvcPresent() {
    this.contextRunner.withUserConfiguration(TestMvcConfiguration.class).run((context) -> {
        AntPathRequestMatcherProvider matcherProvider = context.getBean(AntPathRequestMatcherProvider.class);
        RequestMatcher requestMatcher = matcherProvider.getRequestMatcher("/example");
        assertThat(requestMatcher).extracting("pattern").isEqualTo("/custom/example");
    });
}
Also used : RequestMatcher(org.springframework.security.web.util.matcher.RequestMatcher) AntPathRequestMatcherProvider(org.springframework.boot.autoconfigure.security.servlet.AntPathRequestMatcherProvider) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 AntPathRequestMatcherProvider (org.springframework.boot.autoconfigure.security.servlet.AntPathRequestMatcherProvider)1 RequestMatcher (org.springframework.security.web.util.matcher.RequestMatcher)1