22.10.19 12:01 작성
·
2.2K
0
WebSecurityConfigurerAdapter 가 이제 더 이상 지원을 하지 않는다고 하여 WebSecurityFilterChain으로 하래서 시도중인데 계속하여 401 에러가 뜹니다...
@EnableWebSecurity
public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception{
http
.authorizeRequests()
.antMatchers("api/hello").permitAll()
.anyRequest().authenticated();
return http.build();
}
}
답변 3
2
그리고 antMatchers도 deprecated 되어서 밑에와 같은 방식으로 해주시면 진행 될거에요.
@Configuration
@EnableWebSecurity
public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.authorizeHttpRequests()
.requestMatchers("/api/hello").permitAll()
.anyRequest().authenticated();
return http.build();
}
}
0
0