-
카테고리
-
세부 분야
백엔드
-
해결 여부
미해결
WebSecurityConfigurerAdapter deprecated
22.10.19 12:01 작성 조회수 1.99k
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();
}
}
답변을 작성해보세요.
1
Kang ho Lee
2023.02.25
그리고 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
답변 3