[이론] Securiry 인증순서
필기자
2022-11-03 16:12
7,182
0
본문
Securiry 인증순서
1. UserDetailsService에서 사용자의 정보를 조회, UserDetails로 반환하여 AuthenticationsProvider에게 전달
UserDetailsService의 loadUserByUserName(string) 메소드로 db에서 사용자 정보를 조회 후 UserDetails객체로 변환
2. ProviderManager에서 AuthenticationProvider에게 인증을 위임
AuthenticationProvider에서는 UserDetailsService, UserDetails, PasswordEncoding등을 이용하여 조회한 사용자와 접속사용자 비교 후 인증처리
3. 인증에 성공하면 Authentication 객체를 리턴. 리턴한 Authentication은 SecurityContext에 저장, 클라이언트에 session id(JSESSIONID)를 전달.
4. 클라이언트는 전달받은 JSESSIONID로 최종 인증 완료
최종 로그인된 사용자 정보는 위 코드에서
${#authentication.name}, ${#authentication.getDetails()} 등으로 알수 있음
댓글목록0