super.onAuthenticationSuccess 호출 문의
699
작성한 질문수 32
안녕하세요. 강사님
CustomAuthenticationSuccessHandler 에서는
super.onAuthenticationSuccess 호출 안 함.
CustomAuthenticationFailureHandler 에서는
super.onAuthenticationFailure 호출
CustomAuthenticationSuccessHandler 에서 super.onAuthenticationSuccess 하지 않은 이유가 있을까요?
CustomAuthenticationFailureHandler 에서 super.onAuthenticationFailure 호출하지 않으면 정상적으로 작동하지 않는 듯 합니다. 한편, CustomAuthenticationSuccessHandler 에서는 super.onAuthenticationSuccess 가 있든 없든 정상적으로 작동하는데 주석을 보니 "Removes temporary authentication-related data which may have been stored in the authentication process. " 라고 되어 있습니다.
CustomAuthenticationSuccessHandler 는 super.onAuthenticationSuccess 호출이 선택인가요?
답변 1
1
네
CustomAuthenticationSuccessHandler 와 CustomAuthenticationFailureHandler 모두 super 클래스를 호출하지 않아도 상관없습니다.
다만 CustomAuthenticationFailureHandler 는 실패 이후 이동할 페이지를 지정할 경우 상위클래스에게 위임하는 것이 더 좋다고 판단되어 그렇게 한 것 뿐입니다.
실패와 관련된 여러가지 후속 처리를 해주기 때문입니다.
그렇지만 CustomAuthenticationFailureHandler 가 SimpleUrlAuthenticationSuccessHandler 클래스를 상속하지 않고 AuthenticationSuccessHandler 인터페이스를 구현하셔도 됩니다.
CustomAuthenticationSuccessHandler 는 성공 이후의 작업을 처리하는 클래스인데 상위 클래스를 보시면 성공 이후 이동할 페이지를 결정하는 구문이 여러 갈래로 나뉘어져 있고 그 중에서 하나가 결정되어 이동합니다. 즉 선택권이 없습니다.
그래서 원하는 페이지로 이동하도록 간단하게 직접 구현한 것입니다.
상위 클래스의 로직를 분석해 보시면 여러가지로 도움이 될 수 있습니다.
시큐리티 공부 버전 질문
0
181
1
[해결 방법] MethodSecurityConfig.customMethodSecurityMetadataSource() 호출하지 않는 이슈
0
187
1
AbstractSecurityInterceptor.class.beforeInvocation()를 2번 실행하는 경우
0
182
1
강의 코드가 왜이렇게 뒤죽박죽인가요...
0
257
1
메인 페이지로 접속해도 login url로 리다이렉트가 되지 않습니다..
0
241
1
파라미터값이 넘어가지 않습니다 ....
0
376
1
security filterChain 설정 질문이 있습니다.
0
334
1
소스 부분 질문 드립니다.
0
210
2
섹션4 7번 강의 문제가 있는거 같네요.
0
345
2
파일이 수시로 이름이 바껴있네요 ㄷㄷ
0
308
1
HttpSessionSecurityContextRepository를 사용안하는 문제
0
559
2
error , exception 이 잘 안됩니다.
0
286
2
thymeleaf tag 질문합니다.
0
198
2
버전업하면서 deprecated된 것들이 너무많아요
0
479
1
spring security 패치 관련
0
439
1
모바일을 사용할때 토큰말고 세션
0
856
2
DB 연동한 인가 부분에 대한 질문입니다!
0
265
1
Ajax방식도 똑같이 Session방식을 사용하는건가요?
0
309
1
Config 파일 생성 시 질문이 있습니다.
0
229
1
강사님 몇일동안 구글 검색만 100개 했는데도 이유를 모르겠습니다..
1
435
2
403 에러 뜹니다.
0
814
2
login_proc의 존재에 대한 간략한 설명입니다
0
277
1
top.html에 로그인 링크를 만들어서 로그인을 해봤습니다
0
288
2
안녕하세요. DB에 저장될 때 이해 안 가는 값이 있어서 질문드립니다!
0
192
1





