![[Spring-Security] 스프링 시큐리티 내부 플로우](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcuPip1%2FbtsGTcS8hXh%2FrLZgftbuMUQkop2daWpQn1%2Fimg.png)
[Spring-Security] 스프링 시큐리티 내부 플로우legacy/Spring Security2024. 4. 24. 19:08
Table of Contents
Spring Security Filters
사용자의 요청이 들어왔을 때, Spring Security Filter가 요청을 가로챕니다. 이때, 요청을 한 사용자가 인증이 필요한지 여부를 식별합니다. 인증이 필요한 사용자인 경우, 로그인 페이지로 이동합니다.
Authentication
로그인 페이지에서 입력된 인증 정보(username, password)를 사용하여 Authentication 객체를 생성합니다. 이 객체를 가지고 유효한 인증인지 확인하는 과정이 이루어집니다.
Authentication Manager
넘겨받은 Authentication 객체가 유효한 인증인지 확인합니다. Authentication 객체를 Authentication Providers로 넘겨 유효성 검사를 위임합니다. 이때, Authentication Providers는 여러 개가 존재합니다.
Authentication Providers
Authentication Manager로부터 Authentication 객체를 넘겨받고, 인증을 처리합니다. Authentication에 저장된 세부 정보가 유효한지 확인하는 로직이 포함되어 있습니다.
유저 인증 방식을 정의하기 위해 Spring Security 프레임워크 내에서 구현해야 할 인터페이스입니다.
Security Context
Authentication가 유효한 인증인지 확인이되면, Security Context에 저장되어 관리됩니다. 이후에 사용자가 서버로 요청을 하였을 때 인증하는 과정을 반복하지 않게 됩니다.