|
|
|
@ -32,6 +32,7 @@ import org.springframework.mock.web.MockHttpServletResponse; |
|
|
|
import org.springframework.mock.web.MockServletContext; |
|
|
|
import org.springframework.mock.web.MockServletContext; |
|
|
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
|
|
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
|
|
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; |
|
|
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; |
|
|
|
|
|
|
|
import org.springframework.security.config.web.PathPatternRequestMatcherBuilderFactoryBean; |
|
|
|
import org.springframework.security.core.userdetails.UserDetailsService; |
|
|
|
import org.springframework.security.core.userdetails.UserDetailsService; |
|
|
|
import org.springframework.security.provisioning.InMemoryUserDetailsManager; |
|
|
|
import org.springframework.security.provisioning.InMemoryUserDetailsManager; |
|
|
|
import org.springframework.security.web.FilterChainProxy; |
|
|
|
import org.springframework.security.web.FilterChainProxy; |
|
|
|
@ -157,6 +158,11 @@ public class HttpSecurityRequestMatchersTests { |
|
|
|
@EnableWebMvc |
|
|
|
@EnableWebMvc |
|
|
|
static class MultiMvcMatcherInLambdaConfig { |
|
|
|
static class MultiMvcMatcherInLambdaConfig { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
|
|
|
PathPatternRequestMatcherBuilderFactoryBean requestMatcherBuilder() { |
|
|
|
|
|
|
|
return new PathPatternRequestMatcherBuilderFactoryBean(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
@Bean |
|
|
|
@Order(Ordered.HIGHEST_PRECEDENCE) |
|
|
|
@Order(Ordered.HIGHEST_PRECEDENCE) |
|
|
|
SecurityFilterChain first(HttpSecurity http, PathPatternRequestMatcher.Builder builder) throws Exception { |
|
|
|
SecurityFilterChain first(HttpSecurity http, PathPatternRequestMatcher.Builder builder) throws Exception { |
|
|
|
@ -204,6 +210,11 @@ public class HttpSecurityRequestMatchersTests { |
|
|
|
@EnableWebMvc |
|
|
|
@EnableWebMvc |
|
|
|
static class MultiMvcMatcherConfig { |
|
|
|
static class MultiMvcMatcherConfig { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
|
|
|
PathPatternRequestMatcherBuilderFactoryBean requestMatcherBuilder() { |
|
|
|
|
|
|
|
return new PathPatternRequestMatcherBuilderFactoryBean(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
@Bean |
|
|
|
@Order(Ordered.HIGHEST_PRECEDENCE) |
|
|
|
@Order(Ordered.HIGHEST_PRECEDENCE) |
|
|
|
SecurityFilterChain first(HttpSecurity http, PathPatternRequestMatcher.Builder builder) throws Exception { |
|
|
|
SecurityFilterChain first(HttpSecurity http, PathPatternRequestMatcher.Builder builder) throws Exception { |
|
|
|
@ -249,6 +260,11 @@ public class HttpSecurityRequestMatchersTests { |
|
|
|
@EnableWebMvc |
|
|
|
@EnableWebMvc |
|
|
|
static class MvcMatcherConfig { |
|
|
|
static class MvcMatcherConfig { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
|
|
|
PathPatternRequestMatcherBuilderFactoryBean requestMatcherBuilder() { |
|
|
|
|
|
|
|
return new PathPatternRequestMatcherBuilderFactoryBean(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
@Bean |
|
|
|
SecurityFilterChain filterChain(HttpSecurity http, PathPatternRequestMatcher.Builder builder) throws Exception { |
|
|
|
SecurityFilterChain filterChain(HttpSecurity http, PathPatternRequestMatcher.Builder builder) throws Exception { |
|
|
|
// @formatter:off
|
|
|
|
// @formatter:off
|
|
|
|
@ -283,6 +299,11 @@ public class HttpSecurityRequestMatchersTests { |
|
|
|
@EnableWebMvc |
|
|
|
@EnableWebMvc |
|
|
|
static class RequestMatchersMvcMatcherConfig { |
|
|
|
static class RequestMatchersMvcMatcherConfig { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
|
|
|
PathPatternRequestMatcherBuilderFactoryBean requestMatcherBuilder() { |
|
|
|
|
|
|
|
return new PathPatternRequestMatcherBuilderFactoryBean(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
@Bean |
|
|
|
SecurityFilterChain filterChain(HttpSecurity http, PathPatternRequestMatcher.Builder builder) throws Exception { |
|
|
|
SecurityFilterChain filterChain(HttpSecurity http, PathPatternRequestMatcher.Builder builder) throws Exception { |
|
|
|
// @formatter:off
|
|
|
|
// @formatter:off
|
|
|
|
@ -318,6 +339,11 @@ public class HttpSecurityRequestMatchersTests { |
|
|
|
@EnableWebMvc |
|
|
|
@EnableWebMvc |
|
|
|
static class RequestMatchersMvcMatcherInLambdaConfig { |
|
|
|
static class RequestMatchersMvcMatcherInLambdaConfig { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
|
|
|
PathPatternRequestMatcherBuilderFactoryBean requestMatcherBuilder() { |
|
|
|
|
|
|
|
return new PathPatternRequestMatcherBuilderFactoryBean(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
@Bean |
|
|
|
SecurityFilterChain filterChain(HttpSecurity http, PathPatternRequestMatcher.Builder builder) throws Exception { |
|
|
|
SecurityFilterChain filterChain(HttpSecurity http, PathPatternRequestMatcher.Builder builder) throws Exception { |
|
|
|
// @formatter:off
|
|
|
|
// @formatter:off
|
|
|
|
@ -350,6 +376,11 @@ public class HttpSecurityRequestMatchersTests { |
|
|
|
@EnableWebMvc |
|
|
|
@EnableWebMvc |
|
|
|
static class RequestMatchersMvcMatcherServeltPathConfig { |
|
|
|
static class RequestMatchersMvcMatcherServeltPathConfig { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
|
|
|
PathPatternRequestMatcherBuilderFactoryBean requestMatcherBuilder() { |
|
|
|
|
|
|
|
return new PathPatternRequestMatcherBuilderFactoryBean(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
@Bean |
|
|
|
SecurityFilterChain filterChain(HttpSecurity http, PathPatternRequestMatcher.Builder builder) throws Exception { |
|
|
|
SecurityFilterChain filterChain(HttpSecurity http, PathPatternRequestMatcher.Builder builder) throws Exception { |
|
|
|
// @formatter:off
|
|
|
|
// @formatter:off
|
|
|
|
@ -386,6 +417,11 @@ public class HttpSecurityRequestMatchersTests { |
|
|
|
@EnableWebMvc |
|
|
|
@EnableWebMvc |
|
|
|
static class RequestMatchersMvcMatcherServletPathInLambdaConfig { |
|
|
|
static class RequestMatchersMvcMatcherServletPathInLambdaConfig { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
|
|
|
PathPatternRequestMatcherBuilderFactoryBean requestMatcherBuilder() { |
|
|
|
|
|
|
|
return new PathPatternRequestMatcherBuilderFactoryBean(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
@Bean |
|
|
|
SecurityFilterChain filterChain(HttpSecurity http, PathPatternRequestMatcher.Builder builder) throws Exception { |
|
|
|
SecurityFilterChain filterChain(HttpSecurity http, PathPatternRequestMatcher.Builder builder) throws Exception { |
|
|
|
// @formatter:off
|
|
|
|
// @formatter:off
|
|
|
|
|