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 내부 인증 아키텍쳐
'Spring' 카테고리의 다른 글
SpringSecurity 프로젝트 적용 (0) | 2024.03.03 |
---|---|
SpringSecurity 인증 방식 (0) | 2024.03.02 |
SpringSecurity 아키텍쳐이해하기 (0) | 2024.02.24 |
N+1 문제 해결(JPA) (1) | 2024.02.12 |
N+1 해결 (QueryDSL) (0) | 2024.02.11 |