spring-boot-starter-security 의존성 받아오기.
→ 처음에 하면 모든 요청은 인증을 필요로 한다.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
처음 시작할 때 시큐리티 아이디는 user이고,
비밀번호는 콘솔창에 보여준다.
로그아웃(localhost8080/logout)과 로그인 기능을 제공한다.
6.1 이후로 람다식으로 표현하게 됨.
WebSecurityConfigureAdapter
시큐리티를 사용할 경우 POST 방식 요청시 CSRF토큰 있어야함.p.160~162
예시
validation
시큐리티로 로그인 시 이전 페이지로 이동하고 싶다면?
SuccessHandler 설정해주기.
Spring Security에서 인증은 AuthenticationManager를 통해 이루어지며 AuthenticationManagerBuilder가 AuthenticationManager를 생성한다.