Section 1. Spring Security
1. Spring Security
Spring 기반 애플리케이션의 보안(인증과 인가 등)을 담당하는 스프링 하위 프레임워크
2. Spring Security 구조

- Spring Security 기능은 request 가 DispatcherServlet 에 도달하기 전에 수행되야함
- Servlet Container 에서는 Spring Container Bean 객체 사용 불가
- 따라서 DelegatingFilterProxy 가 SpringSecurityFilterChain 을 찾아 보안 처리 위임

- FilterChainProxy 를 SpringSecurityFilterChain 이라는 이름으로 구현
- FilterChains 에는 여러 filter 존재
- WebSecurityConfigurerAdapter 를 상속 받고 @Enablewebsecurity 를 지정해야 SpringSecurityFilterChain 에 자동 등록됨
- configure(HttpSecurity) 메소드는 http 요청에 대한 인증 및 인가를 처리함
참고 블로그
3. Spring Security 의존성 주입
- Spring Security 추가 시 모든 요청 인증 필요
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
4. Spring Security 기본 login
- 기존에 있던 url 요청 시 스프링 시큐리티에서 기본으로 제공하는 로그인 페이지로 이동

- 기본 제공 ID = "user"
- 기본 제공 PW 는 콘솔창에 1회성으로 출력됨

5. WebSecurityConfigurerAdapter
- 모든 Http 요청에 대해서 인증 절차를 PASS 시키도록 configure(HttpSecurity) 메소드 오버라이딩
- 비밀번호 암호화 기법으로 BCryptPasswordEncoder Bean 객체 생성
