ExceptionTranslationFilter란

wannabeking·2022년 5월 18일
0

Spring

목록 보기
2/4

ExceptionTranslationFilter

  • FilterSecurityInterceptor 바로 위에 위치하며 FilterSecurityInterceptor 실행 중 발생할 수 있는 AuthenticationExceptionAccessDeniedException 의 처리를 담당하는 필터
  • AuthenticationException 는 인증 관련 예외이며 사용자를 로그인 페이지로 보냄
  • AccessDeniedExceptionAccessDecisionManager 에 의해 접근 거부가 발생했을 때 접근 거부 페이지를 보여주거나 사용자를 로그인 페이지로 보냄

doFilter()

  • AuthenticationExceptionAccessDeniedException 이 아니면 this.rethrow()

handleSpringSecurityException()

  • AuthenticationException -> this.handleAuthenticationException()
  • AccessDeniedException -> this.handleAccessDeniedException()

handleAuthenticationException()

  • this.sendStartAuthentication() 호출

handleAccessDeniedException()

  • 익명 사용자 or remberMe 를 통해서 인증 된 사용자의 경우 this.sendStartAuthentication() 호출
  • 둘 다 아닌 경우 this.accessDeniedHandler 호출

sendStartAuthentication()

  • 사용자를 로그인 하도록 리다이렉트 시킴
profile
내일은 개발왕 😎

0개의 댓글