[Spring Security] 내부구조

| Spring Security 내부구조

Spring Security 내부구조

SecurityContextHolder -> SecurityContext -> Authentication -> Principal & GrantAuthority

SecurityContextHolder

  • SecurityContext를 제공하는 static 메소드(getContext)를 지원한다SecurityContext
  • 접근 주체와 인증에 대한 정보를 담고 있는 Context이다.
  • 즉, Authentication을 담고있다

Authentication

  • Principal, GrantAuthority를 제공한다
  • 인증이 이루어지면 해당 Authentication이 저장된다

Principal

  • 유저에 대한 정보
  • 대부분 Principal로 UserDetails를 반환한다

GrantAuthority

  • ROLE_ADMIN, ROLE_USER 등 Principal이 가지고 있는 권한을 나타낸다
  • 권한은 여러개 일 수 있기 때문에 Collection형태로 제공한다

 

| 예제

댓글

Designed by JB FACTORY