Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Tags
- javascript 자동완성
- 주식 양도세 신고방법
- 국세청 해외주식 양도세 신고방식
- java.sql.SQLSyntaxErrorException
- 톰캣 실시간 로그
- 피보나치함수
- 한국투자증권 양도세 신고
- katalon 자동화
- git 연동
- 재귀함수 예제
- 재귀 예제
- katalon 비교
- katalon 사용법
- 최대공약수 예제
- tomcat log
- katalon xpath
- bfs 미로탐색 java
- 한국투자증권 해외주식 양도세
- js 자동완성
- 피보나치함수 예제
- oracle group by
- 테스트 자동화
- Katalon Recorder 사용법
- recursion example
- 홈택스 해외주식 양도세
- 해외증권 양도세 한국투자증권
- 피보나치 예제
- katalon
- CSTS 폭포수 모델
- 해외주식 양도세 신고
Archives
- Today
- Total
엄지월드
WebSecurityConfigurerAdapter is deprecated 본문
반응형
extends WebSecurityConfigurerAdapter 부분에 취소선이 그어져 있어서 마우스를 올려보니 deprecated 되었다고 표시되고 있었다. 이게 무슨 일인가??
공식 문서에서는 아래와 같이 보안상 사용하지 않는다는 것이었다.
https://spring.io/blog/2022/02/21/spring-security-without-the-websecurityconfigureradapter
In Spring Security 5.7.0-M2 we deprecated the WebSecurityConfigurerAdapter, as we encourage users to move towards a component-based security configuration.
그래서 extends WebSecurityConfigurerAdapter 부분을 지워주니 @Override 한 configure에서 에러가 나고 있었다.
@Override
protected void configure(HttpSecurity http) throws Exception {
com.gworld.manage.configuration.AuthenticationSuccessHandler a = new com.gworld.manage.configuration.AuthenticationSuccessHandler();
http.csrf().disable();
http.headers().frameOptions().sameOrigin();
http.authorizeRequests()
.antMatchers( // 로그인이 없어도 접근 가능한 위치를 정의
"/**"
).permitAll();
http.formLogin()
.loginPage("/member/login")
.successHandler(authenticationSuccessHandler)
.permitAll();
http.exceptionHandling()
.accessDeniedPage("/error/denied");
super.configure(http);
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(memberService)
.passwordEncoder(getPasswordEncoder());
super.configure(auth);
}
그래서 configure(HttpSecurity http) 부분을 SecurityFilterChain으로 변경해주었고,
super().configure(http); 대신에 return http.build();로 변경해주었다.
그리고 void configure(AuthenticationManagerBuilder auth) 부분을 AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration)으로 변경해주어 해결하였다.
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception{
com.gworld.manage.configuration.AuthenticationSuccessHandler a = new com.gworld.manage.configuration.AuthenticationSuccessHandler();
http.csrf().disable();
http.headers().frameOptions().sameOrigin();
http.authorizeRequests()
.antMatchers( // 로그인이 없어도 접근 가능한 위치를 정의
"/**"
).permitAll();
http.formLogin()
.loginPage("/member/login")
.successHandler(authenticationSuccessHandler)
.permitAll();
http.exceptionHandling()
.accessDeniedPage("/error/denied");
return http.build();
}
@Bean
public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration)
throws Exception {
return authenticationConfiguration.getAuthenticationManager();
}
'java > Spring' 카테고리의 다른 글
Comments