본문 바로가기

SpringBoot/Spring Security3

ExceptionTranslationFilter 개인 공부 목적으로 작성한 글입니다. 아래 출처를 참고하여 작성하였습니다. 1. ExceptionTranslationFilter ? Spring Security에서 인증/인가 예외 처리 필터입니다. ExceptionTranslationFilter는 SecurityInterceptor와 밀접한 관계가 있습니다. ExceptionTranslationFilter가 try-catch 블록으로 감싼 뒤 SecurityInterceptor를 실행하는 구조. 즉, SecurityInterceptor가 인증/인가 처리를 하는 과정에서 발생하는 예외를 처리합니다. public class ExceptionTranslationFilter extends GenericFilterBean { private AccessDenied.. 2021. 9. 22.
AccessDeniedHandler 개인 공부 목적으로 작성한 포스팅입니다. 아래 출처를 참고하여 작성하였습니다. 1. AccessDeniedHandler란? 인가 처리 과정에서 예외가 발생할 경우 예외를 핸들링하는 인터페이스입니다. e.g. 인증은 성공하였지만, 해당 자원에 접근할 권한이 없는 경우 예외가 발생합니다. ExceptionTranslationFilter가 사용합니다. 2. AccessDeniedHandler 사용방법 2-1. AccessDeniedHandler 인터페이스 구현체 생성 인가 처리 과정에서 예외가 발생한 경우 해당 구현체의 로직을 타게되어, handle 메소드를 실행하게 됩니다. @Component public class JwtAccessDeniedHandler implements AccessDeniedHandl.. 2021. 9. 22.
AuthenticationEntryPoint 개인 공부 목적으로 작성한 포스팅입니다. 아래 출처를 참고하여 작성하였습니다. 1. AuthenticationEntryPoint란 ? 인증 처리 과정에서 예외가 발생한 경우 예외를 핸들링하는 인터페이스입니다. e.g. AuthenticationException(인증되지 않은 요청)인 경우 AuthenticationEntryPoint를 사용하여 처리 ExceptionTranslationFilter가 사용합니다. 2. AuthenticationEntryPoint 사용방법 2-1. AuthenticationEntryPoint 인터페이스 구현체 생성 인증 처리 과정에서 예외가 발생한 경우 해당 구현체의 로직을 타게되어, commence라는 메소드를 실행하게 됩니다. @Component public class E.. 2021. 9. 22.