Spring
SpringSecurity 인증
쭈녁
2024. 3. 1. 16:41
SecurityContextHolder
- SecurityContext 가 세팅되면, 현재 인증된 사용자로 부터 정보를 사용할 수 있다.
- 직접 세팅 or 자동 세팅(UserDetail ,UserDetailService)
- SecurityContext 객체를 ThreadLocal 로 저장(쓰레드별 동시성 보장).
- FilterChainProxy에 의해 초기화가 보장
SecurityContext
- 현재 인증된 사용자의 Authentication 을 포함
Authentication
- 인증된 정보가 포함됨
- principal: 식별된 사용자 정보
- credentials: 보통 password 이며, 대부분의 경우 노출 방지를 위해 인증된 후 초기화
- authorities: 인가된 권한
인증 객체 구조

인증을 수행하는 Component
AuthenticationManager
- Security Filter에서 어떻게 인증을 수행하는지 정의한 API.
- 가장 일반적인 구현체는 ProviderManager
ProviderManager
- AuthenticationManager 의 가장 일반적인 구현체
- 다수의 AuthenticationProvider에게 인증에 대한 객체 생성을 위임
- 각 AuthenticationProvider는 인증 방식에 대해 정의
AbstractAuthenticationProcessingFilter
- 인증을 수행하기 위한 Filter
FilterChain 내부 인증 아키텍쳐


