|
1 | 1 | /*
|
2 |
| - * Copyright 2016-2024 the original author or authors. |
| 2 | + * Copyright 2016-2025 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
64 | 64 | import org.springframework.security.messaging.context.SecurityContextPropagationChannelInterceptor;
|
65 | 65 | import org.springframework.security.provisioning.InMemoryUserDetailsManager;
|
66 | 66 | import org.springframework.security.web.SecurityFilterChain;
|
67 |
| -import org.springframework.security.web.util.matcher.AntPathRequestMatcher; |
68 | 67 | import org.springframework.test.annotation.DirtiesContext;
|
69 | 68 | import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig;
|
70 | 69 | import org.springframework.test.web.client.MockMvcClientHttpRequestFactory;
|
|
80 | 79 | import org.springframework.web.multipart.support.StandardServletMultipartResolver;
|
81 | 80 | import org.springframework.web.server.ResponseStatusException;
|
82 | 81 | import org.springframework.web.servlet.DispatcherServlet;
|
| 82 | +import org.springframework.web.servlet.config.annotation.EnableWebMvc; |
83 | 83 |
|
84 | 84 | import static org.assertj.core.api.Assertions.assertThat;
|
85 | 85 | import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.httpBasic;
|
@@ -211,6 +211,7 @@ public void testMultiPartFiles() throws Exception {
|
211 | 211 | }
|
212 | 212 |
|
213 | 213 | @Autowired
|
| 214 | + @Qualifier("customValidator") |
214 | 215 | private Validator validator;
|
215 | 216 |
|
216 | 217 | @Test
|
@@ -299,6 +300,7 @@ protected Object handleRequestMessage(Message<?> requestMessage) {
|
299 | 300 | @Configuration
|
300 | 301 | @EnableWebSecurity
|
301 | 302 | @EnableIntegration
|
| 303 | + @EnableWebMvc |
302 | 304 | public static class ContextConfiguration {
|
303 | 305 |
|
304 | 306 | @Bean
|
@@ -327,7 +329,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
327 | 329 | return http
|
328 | 330 | .authorizeHttpRequests((authorizeHttpRequests) ->
|
329 | 331 | authorizeHttpRequests
|
330 |
| - .requestMatchers(new AntPathRequestMatcher("/service/internal/**")).hasRole("ADMIN") |
| 332 | + .requestMatchers("/service/internal/**").hasRole("ADMIN") |
331 | 333 | .anyRequest().permitAll())
|
332 | 334 | .httpBasic(Customizer.withDefaults())
|
333 | 335 | .csrf(AbstractHttpConfigurer::disable)
|
|
0 commit comments