-
참조
- 참조 블로그: https://velog.io/@ewan/Spring-Security-Custom-Authentication-Provider
-
기본적인 인증 흐름

-
Authentication Provider
- Authentication Provider란
- DB에서 가져온 정보와 입력된 정보가 비교되는 로직이 작성되는 부분
- password가 암호화된 경우 비교하는 로직 작성
- 구성
- AuthenticationProvider를 상속하면
authenticate() 메서드 재정의 가능
authenticate()메서드의 경우 **Authentication(인증객체)**에 접근이 가능하며 인증객체가 입력된 사용자 정보
- Authentication은 로그인 아이디, 비밀번호를 가짐 → UserdetailsService를 통해 UserDetails를 가져옴
- 인증이 완료됐다면 UsernamePasswordAuthenticationToken객체를 반환
supports()
- AuthenticationProvider 표시된 Authentication객체 지원 여부 반환
- 즉, 해당 Authentication객체가 올바른 상태인지 확인하는 메서드
- 보통 UsernamePasswodAuthenticationToken타입인지 확인