[ODOP] 83일차 - Authentication (인증)
![[ODOP] 83일차 - Authentication (인증)](/content/images/size/w1200/2023/08/-----2023-08-01----10.29.26-17.png)
- 사용자의 인증 정보를 저장하는 토큰 개념
- 인증 시 id 와 password 를 담고 인증 검증을 위해 전달되어 사용된다
- 인증 후 최종 인증 결과 (user 객체, 권한정보)를 담고 SecurityContext 에 저장되어 전역적으로 참조가 가능하다
Authentication authentication = SecurityContextHolder.getContext()
.getAuthentication();
구조
- principal
사용자 아이디 혹은 User 객체를 저장 - credentials
사용자 비밀번호 - authorities
인증된 사용자의 권한 목록 - details
인증 부가 정보 - Authenticated
인증 여부
Authentication 인증 흐름
![](https://blog.pollra.com/content/images/2023/08/-----2023-09-01----3.58.44.png)