Fix HttpDslTests for latest Spring Security

This commit is contained in:
Artem Bilan
2022-10-11 11:21:35 -04:00
parent f4d7c4f5d3
commit c68ec19f89

View File

@@ -70,6 +70,7 @@ import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig;
import org.springframework.test.web.client.MockMvcClientHttpRequestFactory;
@@ -321,9 +322,9 @@ public class HttpDslTests {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
return http.
authorizeRequests()
.antMatchers("/service/internal/**").hasRole("ADMIN")
return http
.authorizeHttpRequests()
.requestMatchers(new AntPathRequestMatcher("/service/internal/**")).hasRole("ADMIN")
.anyRequest().permitAll()
.and()
.httpBasic()