[ODOP] 86일차 - 스프링 시큐리티 아키텍처:초기화 흐름
![[ODOP] 86일차 - 스프링 시큐리티 아키텍처:초기화 흐름](/content/images/size/w1200/2023/08/-----2023-08-01----10.29.26-20.png)
![](https://blog.pollra.com/content/images/2023/08/-----2023-09-01----4.09.22.png)
- Filter 를 기준으로
- 위쪽은 Security 의 초기화 과정이다
- 아래쪽은 각 Filter 의 처리 과정이다
Security 초기화 흐름
-
Spring 에서 설정한 SecurityConfig 에 따라 HttpSecurity 클래스가 Filter 들을 생성
- 이 설정은 WebSecurityConfigurerAdapter 를 통해 만들어진다
- 설정 클래스가 두개라면 두개의 설정 모두 생성되며 추후 2번을 통해 실행이 이루어진다.
-
만들어진 Filter 목록들은 WebSecurity 가 받고, FilterChainProxy 의 Bean 객체를 생성
이 때, 생성자로 1번에서 만들어진 Filter 들을 전달
- 이 시점에 DelegatingFilterProxy 도 함께 초기화
- 만들어진 bean 의 이름은
springSecurityFilterChain
-
서블릿 Filter 로 만들어져있는 DelegationgFilterProxy는 사용자의 요청이 들어오는 경우 실행
-
만약 DelegationgFilterProxy 가 실행될 경우 springSecurityFilterChain 이라는 이름을 가진 bean 에게 사용자의 요청 정보를 넘겨 인증/인가 행위를 위임