OAuth 2.0 Resource Server MAC & RSA 토큰 검증 - @AuthenticationPrincipal 참조

Authentication

  • 리소스 서버에서 토큰 검증이 이루어지면 토큰으로부터 정보를 추출해서 인증 객체를 구성하게 된다.

  • 스프링 시큐리티의 자원에 대한 접근은 인증 객체의 인증 유무와 권한 정보에 따라 결정되기 때문에 인증 객체를 생성해야 한다.

  • 인증 객체는 JwtAuthenticationToken 타입으로 생성되고 SecurityContext에 저장된다.


Jwt

  • JwtDecoder 는 검증이 성공하면 토큰의 클레임으로부터 정보를 추출해서 최종 Jwt 객체를 반환한다.

  • Jwt 객체는 JwtAuthenticationTokenprincipal 속성에 저장된다.


@AuthenticationPrincipal

  • JwtAuthenticationTokenprincipal 에 저장되어 있는 Jwt 객체를 바로 참조할 수 있다.

img_11.png

IndexController


이전 ↩️ - OAuth 2.0 Resource Server MAC & RSA 토큰 검증 - JwkSetUri 에 의한 검증(RSA)arrow-up-right

메인 ⏫arrow-up-right

다음 ↪️ - OAuth 2.0 Resource Server MAC & RSA 토큰 검증 - BearerTokenAuthenticationFilter 이해arrow-up-right

Last updated