Authentication

이승민·2022년 10월 16일
post-thumbnail

SecurityContextHolder

  • SecurityContext 제공, 기본적으로 ThreadLocal을 사용
    (ThreadLocal: 한 스레드 내에서 공유하는 저장소)
  • 인증이된 정보가 들어간다.

SecurityContext

  • Authentication 제공

Authentication

  • PrincipalGrantAuthority 제공

Principal

  • "누구"에 해당하는 정보
  • UserDetailsService에서 리턴한 그 객체
  • 객체는 UserDetails 타입
  • userDetailservice를 구현한 객체가 Principal이 된다.

GrantAuthority

  • "ROLE_USER", "ROLE_ADMIN" 등 Principal이 가지고 있는 "권한"을 나타낸다.
  • 인증 이후, 인가 및 권한 확인할 때 이 정보를 참조한다.
  • userDetails에서 roles로 추가한 것

UserDetails

  • 애플리케이션이 가지고 있는 유저 정보와 스프링 시큐리티가 사용하는 Authentication 객체 사이의 어댑터

UserdetailsService

  • 유저 정보를 UserDetails 타입으로 가져오는 DAO 인터페이스
  • 정보를 제공하는 역할이지 인증을 하는 역할이 아니다```
코드를 입력하세요
profile
💻 끊임없이 성장하는 백엔드 개발자 💻

0개의 댓글