spring security 사용하는 이유
- spring의 생태계에서 보안에 필요한 기능을 제공
- spring이라는 프레임워크 안에서 활용하기 적합한 구조로 설계 되어 있어, 보안 기능을 추가 용이
Spring Security 아키텍처
- 사용자의 요청이 서버로 들어옴
- Authentication Filter가 요청을 가로채고 Authentication Manager로 요청 위임
- 등록된 Authentication provider를 조회하여 인증 요구
- Authentication provider 가 실제 데이터 조회 → userDetails 반환
- securityContextHolder에 저장
Spring Security 작동 구조
- 사용자가 자격 증명 정보 제출, AbstractAuthenticationProcessingFilter가 Authentication 객체 생성
- Authentication 객체가 AuthenticationManager에게 전달
- 인증 성공 -> 새로운 로그인, securityContextHolder에 저장, 세션 저장 or 토큰 발급
- rememberMeservices.loginSuccess() 실행 → interactiveAuthenticationSuccessEvent 발생 → AuthenticatioSuccessHandler 실행
'web 개발 > auth' 카테고리의 다른 글
naver mail을 이용한 회원가입 (0) | 2024.06.23 |
---|