반응형
SecurityContext
-
[스프링 시큐리티] Authentication 객체 저장소(SecurityContext, SecurityContextHolder)강의노트/스프링 시큐리티 2020. 9. 14. 18:37
SecurityContext Authentication 객체가 저장되는 보관소로 필요 시 언제든지 Authentication 객체를 꺼내 쓸 수 있도록 제공되는 클래스 Authentication 객체 안에는 User 객체가 저장되어 있다. ThreadLocal에 저장되어 아무곳에서나 참조가 가능하다. ThreadLocal? Thread마다 고유하게 할당되는 저장소 인증이 완료되면 HttpSession에 저장되어 어플리케이션 전반에 걸쳐 전역적인 참조가 가능하다. SecurityContextHolder SecurityContext 객체를 감싸고 있는 클래스이다. SecurityContext 객체 저장 방식 MODE_THREADLOCAL : 스레드당 SecurityContext 객체를 할당 (default)..