Spring Security - 인증 플로우, AuthenticationManager, AuthenticationProvider
2021. 4. 17. 22:19ㆍSPRING/SPRING SECURITY
인증 플로우
AuthenticationManager
- 실제 인증역할은 하지 않는다.
- 필터에서 인증 객체를 받아 Form 인증, RememberMe 인증, OAuth 인증 등, 인증 요청에 따라 그에 맞는 AuthenticationProvider를 찾아 실제 인증 역할을 위임한다.
AuthenticationProvider
- ID검증, Password검증, 추가검증을 하고 인증에 성공하면 UserDetails 객체를 AuthenticationManager에 리턴한다.
- ID검증: UserDetailsService에서 ID를 가진 사용자가 있는지 검증한다. 없으면 UserNotFoundException을 생성한다.
- Password검증: 서버에 저장된 암호화된 비밀번호를 복호화하고 클라이언트에서 요청온 비밀번호와 비교하여 검증한다. 비밀번호가 맞지 않으면 BadCredentialException을 생성한다.
'SPRING > SPRING SECURITY' 카테고리의 다른 글
Spring Security - AccessDecisionManager, AccessDecisionVoter (0) | 2021.04.17 |
---|---|
Spring Security - 인가 플로우, FilterSecurityInterceptor (0) | 2021.04.17 |
Spring Security - SecurityContextPersistenceFilter (0) | 2021.04.17 |
Spring Security - SecurityContext, SecurityContextHolder (0) | 2021.04.17 |
Spring Security - Authentication 구조 (0) | 2021.04.16 |