- 전체 구조
- AuthenticationFilter : AuthenticationManager = N : 1
- AuthenticationManager : AuthenticationProvider = 1 : N
- SecurityContextHolder - Spring Security에서 인증된 사용자의 세부 정보를 저장하는 곳입니다. 이는 현재 애플리케이션의 보안 컨텍스트에 대한 중앙 저장소 역할을 합니다.
- SecurityContext - SecurityContextHolder에서 얻을 수 있으며, 현재 인증된 사용자의 Authentication 객체를 포함합니다. 이는 현재 실행 중인 스레드와 연관된 보안 정보를 담고 있습니다.
- Authentication - 두 가지 주요 목적으로 사용됩니다:
- AuthenticationManager에 입력으로 제공되어 사용자가 인증을 위해 제공한 자격 증명을 나타냅니다.
- SecurityContext에서 현재 인증된 사용자를 나타냅니다.
이 객체는 주체, 자격 증명, 권한 등의 정보를 포함합니다.
- GrantedAuthority - Authentication 객체 내에서 주체(principal)에게 부여된 권한을 나타냅니다. 이는 사용자 역할(roles), 범위(scopes) 등을 포함할 수 있으며, 사용자가 수행할 수 있는 작업을 정의합니다.
- AuthenticationManager - Spring Security의 필터가 인증을 수행하는 방법을 정의하는 API입니다. 이는 인증 프로세스의 핵심 인터페이스로, Authentication 객체를 입력으로 받아 인증을 수행합니다.
- ProviderManager - AuthenticationManager의 가장 일반적인 구현체입니다. 여러 AuthenticationProvider 인스턴스의 체인을 관리하여 다양한 인증 메커니즘을 지원합니다.
- AuthenticationManager : ProviderManager = 1 : 1
- AuthenticationManager : ProviderManager = 1 : N
- AuthenticationManager : ProviderManager = 1 : 1
- AuthenticationProvider - ProviderManager에 의해 사용되어 특정 유형의 인증을 수행합니다. 예를 들어, 사용자 이름/비밀번호 기반 인증, LDAP 인증, OAuth 인증 등 다양한 인증 방식을 구현할 수 있습니다.
- AuthenticationEntryPoint를 통한 요청 자격 증명 - 클라이언트로부터 자격 증명을 요청하는 데 사용됩니다. 예를 들어, 로그인 페이지로 리디렉션하거나, WWW-Authenticate 응답을 보내는 등의 작업을 수행합니다. 이는 인증되지 않은 요청이 보호된 리소스에 접근하려 할 때 호출됩니다.
- AbstractAuthenticationProcessingFilter - 인증에 사용되는 기본 Filter입니다. 이 클래스는 인증의 높은 수준의 흐름과 각 구성 요소가 어떻게 함께 작동하는지에 대한 좋은 아이디어를 제공합니다. 이는 다양한 인증 메커니즘을 구현하는 데 사용되는 추상 클래스로, 사용자 이름/비밀번호 인증, OAuth, JWT 등의 구체적인 인증 필터의 기반이 됩니다.
- 출처: https://docs.spring.io/spring-security/reference/servlet/authentication/architecture.html#servlet-authentication-authenticationentrypoint
'WEB BE > Spring Security' 카테고리의 다른 글
스프링 시큐리티 아키텍처 (0) | 2024.09.27 |
---|