본문 바로가기

Web/spring

[Spring Security] WebSecurityConfigurerAdapter deprtecate

728x90

 

 

 

Spring Security 를 공부하던 중,

예제를 보고 따라하다가 예제에서 사용하는

WebSecurityConfigurerAdapter 가 deprecate 되어있다는 것을 확인했다.

 

 

🤨 방법이 새롭게 있겠지..

검색검색

 

 

https://docs.spring.io/spring-security/reference/servlet/oauth2/login/advanced.html

 

Advanced Configuration :: Spring Security

By default, the OAuth 2.0 Login Page is auto-generated by the DefaultLoginPageGeneratingFilter. The default login page shows each configured OAuth Client with its ClientRegistration.clientName as a link, which is capable of initiating the Authorization Req

docs.spring.io

 

 

이렇게 쓰라고 알려준다.

 

 

 

 

    @Bean
    public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {

        // csrf cross-site request forgery : 사이트 간 요청 위조

        http.csrf().disable()
                .authorizeRequests()
                .antMatchers("/**").authenticated()
                .anyRequest().permitAll();
        return http.build();


    }

 

security 에 대해 정의해둔게 없어서

일단 한번 코드 작성해봄..

아무튼 결론만 말하자면 필터체인에 빈을 등록해서 사용하라고 하는 듯 하다.

728x90