WebSecurityConfigurerAdapter라는 추상 클래스를 상속받고, configure 메서드를 오버라이드해서 설정했음.스프링 시큐리티 5.7.0-M2부터 WebSecurityConfigurerAdapter는 deprecated, 즉 더 이상 사용할 수 없음.
Spring Security without the WebSecurityConfigurerAdapter을 참고.
@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeHttpRequests((authz) -> authz
.anyRequest().authenticated()
)
.httpBasic(withDefaults());
}
}
WebSecurityConfigurerAdapter를 사용했던 것을 아래와 같이 변경.@Configuration
public class SecurityConfiguration {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.authorizeHttpRequests((authz) -> authz
.anyRequest().authenticated()
)
.httpBasic(withDefaults());
return http.build();
}
}