이 글은 세션 기반의 Form 로그인 인증 절차에 대해서 다루고 있다.

이미지 출처 : 유튜브 "개발자 유미"님
기본 로직은 다음과 같다.
UsernamePasswordAuthenticationFilter는 폼 로그인 활성화 시 사용되는 필터로, username과 password 기반의 인증을 처리하는 시큐리티 필터이다.

DaoAuthenticationProvider는 AuthenticationProvider의 구현체 중 하나이다.
또한 UsernamePasswordAuthenticationFilter의 인증 과정에서 Authentication Manager에 의해 호출되는 Authentication Provider 중 하나로써, 실질적인 인증 기능을 담당한다.
DaoAuthenticationProvider가 사용되는 UsernamePasswordAuthenticationFilter의 인증 절차는 다음과 같다.

UsernamePasswordAuthenticationFilter가 HttpServletRequest로부터 제출된 username과 password를 추출하여 UsernamePassword Authentication Token을 생성한다. 그리고 생성된 토큰을 Authentication Manager의 구현체인 ProviderManager로 넘겨준다.
ProviderManager는 DaoAuthenticationProvider라는 타입의 AuthenticationProvider를 사용하도록 설정되어 있다.
DaoAuthenticationProvider는 UserDetailsService로부터 UserDetails를 확인한다.
DaoAuthenticationProvider는 PasswordEncoder(ex. 빈으로 등록한 BcryptPasswordEncoder)를 사용하여 이전 단계에서 넘겨받은 UserDetails의 password를 검증하는 데 사용한다.
인증(Authentication)이 성공하면, 설정된 UserDetailsService에 의해 반환된 UserDetails의 주요 정보를 담은 UsernamePasswordAuthenticationToken을 반환하게 된다.
최종적으로, 반환된 UsernamePasswordAuthenticationToken는 authentication Filter에 의하여 SecurityContextHolder에 set된다.
3, 4번에서 DaoAuthenticationProvider에 의한 실질적인 인증 과정이 진행된다.
UsernamePasswordAuthenticationFilter 역할 참고 :
https://docs.spring.io/spring-security/reference/servlet/authentication/architecture.html#servlet-authentication-abstractprocessingfilter
DaoAuthenticationProvider 절차 참고 :
https://docs.spring.io/spring-security/reference/servlet/authentication/passwords/dao-authentication-provider.html#page-title