이틀동안 이해는 안 되는데 강의만 쭉 보다가 TIL을 못 썼다..
오늘부터는 내용 정리로라도 TIL을 써야겠다.
SpringSecurity를 사용하면 인증과 인가 처리를 자동으로 해주고 보안상으로도 유리하다.
SpringSecurity Filter 종류
- SecurityContextPersistenceFilter : SecurittyContextRepository에서 SecurityContext(접근 주체와 인증에 대한 정보를 담고 있는 객체)를 가져오거나 저장하는 역할을 합니다.
- LogoutFilter : 설정된 로그아웃 URL로 오는 요청을 확인해 해당 사용자를 로그아웃 처리합니다.
- UsernamePasswordAuthenticationFilter : 인증 관리자입니다. 폼 기반으로 로그인을 할 때 사용되는 필터로 아이디, 패스워드 데이터를 파싱해 인증요청을 위임합니다. 인증이 성공하면 AuthenticationSuccessHandler를, 인증에 실패하면 AuthenticationFailureHandler를 실행합니다.
- DefaultLoginPageGeneratingFilter : 사용자가 로그인 페이지를 따로 지정하지 않았을 때 기본으로 설정하는 로그인 페이지 관련 필터입니다.
- BasicAutenticationFilter : 요청 헤더에 있는 아이디와 패스워드를 파싱해서 인증 요청을 위임합니다. 인증이 성공하면 AuthenticationSuccessHandler를, 인증에 실패하면 AuthenticationFailureHandler를 실행합니다.
- RequestCacheAwareFilter : 로그인 성공 후, 관련있는 캐시 요청이 이쓴ㄴ지 확인하고 캐시 요청을 처리해줍니다. 예를 들어 로그인하지 않은 상태로 방문했던 페이지를 기억해 두었다가 로그인 이ㅜㅎ에 그 페이지로 이동 시켜줍니다.
- SecurityContextHolderAwareRequestFilter : HttpServletRequest 정보를 감쌉니다. 필터 체인 상의 다음 필터들에게 부가 정보를 제공 되기 위해 사용합니다.
- AnonymousAuthenticationFilter : 필터가 호출되는 시점가지 인증되지 않았다면 익명 사용자 전용 객체인 AnonymousAuthentication을 만들어 SecurityContext에 넣어줍니다.
- SessionmanagementFilter : 인증된 사용자와 관련된 세션 관련 작업을 진행합니다. 세션 변조 방지 전략을 설정하고, 유효하지 않은 세션에 대한 처리를 하고, 세션생성 전력을 세우는 등의 작업을 처리합니다.
- ExceptionTranslationFilter : 요청을 처리하는 중에 발생할 수 있는 예외를 위임하거나 전달합니다.
- FilterSecurityInterceptor : 접근 결정 관리자입니다. AccessDecisionManager로 권한 부여 처리를 위임함으로써 접근제어 결정을 쉽게 해줍니다. 이 과정에서는 이미 사용자가 인증되어 있으므로 유효한 사용자인지도 알 수 있습니다. 즉, 인가관련 설정할 수 있습니다.
JAVA Exeption(예외처리) 종류
- NullPointerException : 값이 Null인데 호출 했을 때 생기는 에러
- IllegalArgumentException : 잘못된 값을 입력 받았을 때, 해당하는 값이 없을 때
- ArithmeticException : 나눗셈 연산시 분모가 0일때
- IllegalFormatConversionException : Format형식과 값이 매칭되지 않을 때
- IndexOutofBoundsException : 배열범위를 벗어나서 참조할 때
...