- 스프링 시큐리티는 FilterChain 기반으로 동작한다.
- 스프링 시큐리티의 인증은 인증을 담당하는 Filter에 의해 처리된다.
- 가장 일반적인 인증 과정인 UsernamePassword 인증 과정의 흐름을 이해해보자.

Authentication을 담당하는 주요 인터페이스는 아래와 같다.
각 클래스(인터페이스)의 입장에서 일어나는 일을 순차적으로 기술
UsernamePasswordAuthenticationFilter
- 인증 필터 (Filter의 구현체)
- doFilter 호출
doFilter
메소드는 부모 추상클래스에 구현되어 있음
- 여기서 chain은 FilterChainProxy의 inner class인 VirtualFilterChain 이므로 깡
return
이나다음_필터로_고고(chain)
이나 사실상 같음
인증시도(req,resp)
의 내부
-
AuthenticationManager
에게 -
Authentication
- 인증안된 인증객체 전달 Authentication
- 인증된 인증객체 받아옴
ProviderManager
- 인증 관리자 (AuthenticationManager 의 구현체)
- 자신이가진 AuthenticationProvider 중에 해당 인증객체를 지원하는 provider를 찾아 인증 안된 인증객체를 전달, 인증 로직을 위임
DaoAuthenticationProvider
- 인증 제공자 (AuthenticationProvider 의 구현체)
authenticate
호출
- authenticate 메소드는 부모 추상클래스에 구현되어있음
retrieveUser
호출
비밀번호_매칭_검증
호출
UserDetailsService
혹은 UserDetailsManager
- 제주껏 UserDetails 객체를 하나 생성하는 메서드를 구현하면 된다.