728x90

- UsernamePasswordAuthenticationFilter
- form 인증방식을 인증을 하게 되면 동작하는 필터
- Authentication객체에 ID,Password를 담고 AuthenticationManager에 위임한다.
- 인증이 완료된 Authentication 객체를 받게 되면 SecurityContext에 인증 객체를 저장한다.
- AuthenticationManager
- 전달받은 인증객체를 가지고, 인증의 전반적인 관리를 한다.
- AuthenticationProvider에 실제 인증검증을 위임한다(실제 인증은 AuthenticationProvider가 하는 것이다)
- 인증이 성공하면 Authentication(UserDetails + authorities) 객체를 만들어 UsernamePasswordFilter에 전달한다.
- AuthenticationProvider
- 전달받은 인증 객체를 실제로 검증한다.
- loadUserByUsername(username) 메서드를 호출하여 UserDetailsService에 실제 사용자를 요청한다.
- UserDetailsService
- 해당 서비스에서 findById()를 통해 유저 객체를 조회한다.
- Repository
- 유저 객체가 없다면 UsernamePasswordAuthenticationFilter에 예외를 전달하여 failuareHandler를 실행하게 되는 것이다.
- 유저 객체가 있다면 UserDetails타입으로 서비스에 반환한다.
728x90
'스프링 시큐리티' 카테고리의 다른 글
| Ch02. 스프링 시큐리티 주요 아키텍처 이해 - 인증 처리자(AuthenticationProvider) (0) | 2022.01.17 |
|---|---|
| Ch02. 스프링 시큐리티 주요 아키텍처 이해 - 인증 관리자(AuthenticationManager) (0) | 2022.01.17 |
| Ch02. 스프링 시큐리티 주요 아키텍처 이해 - 인증 저장소 필터(SecurityContextPersistenceFilter) (0) | 2022.01.16 |
| Ch02. 스프링 시큐리티 주요 아키텍처 이해 - 인증 저장소(SecurityContextHolder, SecurityContext) (0) | 2022.01.16 |
| Ch02. 스프링 시큐리티 주요 아키텍처 이해 - 인증 개념 이해(Authentication) (0) | 2022.01.16 |