OAuth 2.0 Resource Server MAC & RSA 토큰 검증 - JwtAuthorizationRsaFilter(RSA)
application.yml
spring:
security:
oauth2:
resourceserver:
jwt:
jws-algorithms: RS256RsaSecuritySigner
public class RsaSecuritySigner extends SecuritySigner{
@Override
public String getJwtToken(UserDetails user, JWK jwk) throws JOSEException {
RSASSASigner jwsSigner = new RSASSASigner(((RSAKey)jwk).toRSAPrivateKey());
return super.getJwtTokenInternal(jwsSigner, user, jwk);
}
}
SecuritySigner를 상속 받아RSA기반 서명 및 토큰을 발행하는 클래스
SecuritySigner
SignatureConfig
JwtAuthorizationFilter
MAC방식과RSA방식을 같이 처리할 수 있게 하기 위해 추상 클래스로 변경
JWSVerifier의 구현체로 RSASSAVerifier와 MACVerifier가 있다.
JwtAuthorizationRsaFilter
SecurityConfig
이전 ↩️ - OAuth 2.0 Resource Server MAC & RSA 토큰 검증 - JwtDecoder 에 의한 검증(MAC)
다음 ↪️ - OAuth 2.0 Resource Server MAC & RSA 토큰 검증 - JwtDecoder 에 의한 검증(RSA)
PreviousOAuth 2.0 Resource Server MAC & RSA 토큰 검증 - JwtAuthorizationMacFilterNextOAuth 2.0 Resource Server MAC & RSA 토큰 검증 - JwtDecoder 에 의한 검증(MAC)
Last updated