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