개발새발
#spring security 본문
spring security란 spring기반의
애플리케이션의 보안(인증, 인가, 권한등)을 담당하는 스프링 하위 프레임워크
- '인증', '권한'에 대한 부분을 Filter 흐름에 따라 처리
- Filter는 Dispatcher Servlert로 가기전에 적용되므로 가장 먼저 URL요청을 받음
- 사용자가 Username과 Password를 통해 인증을 요청
- AuthenticationFilter의 구현체인 UsernamePasswordAuthenticationFilter는 전달받은 Username과 Password를 가지고 UsernamePasswordAuthenticationToken을 생성
- 생성된 Authentication을 AuthenticationManager에 전달
- AuthenticationManager는 전달받은 Authentication을 다수의 AuthenticationProvider에 전달하여 유효성 검증 및 처리를 위임
- 입력받은 사용자의 인증 정보의 유효성 검증을 위해 UserDetailsService로 전달
- UserDetailsService는 loadUserByUsername() 메소드를 통해 사용자 정보를 조회하여 실제 존재하는 사용자인지, Username과 Password가 유효한지 검증
- 만약 6에서 사용자의 인증 정보 검증이 성공적으로 이루어졌다면 해당 사용자 정보를 활용해 UserDetails를 생성
- 생성된 UserDetails를 AuthenticationProvider에 전달
- authenticate() 메소드가 호출되며 UserDetails와 Authorities로 생성한 Authentication을 전달
- 생성된 Authentication을 AuthenticationFilter에 전달
- AuthenticationFilter는 인증 처리가 모두 완료되어 해당 사용자의 인증 정보를 담고 있는 Authentication을 SecurityContext에 저장
'스프링' 카테고리의 다른 글
Spring MVC 예외처리 기법 (0) | 2022.10.26 |
---|---|
서블릿(Servlet) (0) | 2022.09.11 |
트랜잭션이란? (0) | 2022.08.04 |
ORM이란? (0) | 2022.08.04 |
# REST Client (0) | 2022.08.04 |
Comments