
1. ExceptionTranslationFilter
- 요청에 대해 SecurityFilterChain의 필터들이 보안 처리 중 발생하는 인증 혹은 인가 예외에 대한 처리를 맡습니다.
- 인증 예외는 AccessDeniedException, 인가 예외는 AuthenticationException 입니다.
- 자바 예외와 HTTP Response 의 브릿지 역할을 합니다.
- AuthenticationException 이 발생할 경우
- AuthenticationEntryPoint을 동작시킵니다.
- 인증 예외에 대해 원하는 동작을 커스터마이징 할 수 있습니다.
- 사용자를 로그인 페이지로 리다이렉트하거나 적절한 응답코드를 반환하는 등의 작업이 가능합니다.
- AuthenticationEntryPoint을 동작시킵니다.
- AccessDeniedException 이 발생할 경우
- anonymous user 일 경우
- AuthenticationEntryPoint을 동작시킵니다.
- anonymous user 가 아닐 경우
- AccessDeniedHandler에게 예외처리를 위임합니다.
- anonymous user 일 경우
참고
'Spring > Spring Security' 카테고리의 다른 글
[Spring Security] 3-3. Authentication: Password Storage (0) | 2023.10.02 |
---|---|
[Spring Security] 3-2. Authentication: Username/Password (2) | 2023.10.02 |
[Spring Security] 3-1. Authentication: Architecture (0) | 2021.07.28 |
[Spring Security] 1. Architecture (0) | 2021.07.28 |
[Spring Security] 2-1. 인증 필터 (0) | 2021.07.25 |