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 |
Tags
- katalon 자동화
- oracle group by
- katalon 사용법
- katalon 비교
- 피보나치함수 예제
- 최대공약수 예제
- CSTS 폭포수 모델
- 테스트 자동화
- katalon
- javascript 자동완성
- 재귀함수 예제
- git 연동
- js 자동완성
- Katalon Recorder 사용법
- 주식 양도세 신고방법
- 해외주식 양도세 신고
- recursion example
- 한국투자증권 양도세 신고
- 재귀 예제
- 한국투자증권 해외주식 양도세
- tomcat log
- 홈택스 해외주식 양도세
- java.sql.SQLSyntaxErrorException
- 톰캣 실시간 로그
- 국세청 해외주식 양도세 신고방식
- 피보나치 예제
- bfs 미로탐색 java
- katalon xpath
- 피보나치함수
- 해외증권 양도세 한국투자증권
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