OAuth 2.0 Resource Server MAC & RSA 토큰 검증 - JwtDecoder 에 의한 검증(MAC)
JwtDecoderConfig
@Configuration
public class JwtDecoderConfig {
@Bean
@ConditionalOnProperty(prefix = "spring.security.oauth2.resourceserver.jwt", name = "jws-algorithms", havingValue = "HS256", matchIfMissing = false)
public JwtDecoder jwtDecoderBySecretKeyValue(OctetSequenceKey octetSequenceKey, OAuth2ResourceServerProperties properties) {
return NimbusJwtDecoder.withSecretKey(octetSequenceKey.toSecretKey())
.macAlgorithm(MacAlgorithm.from(properties.getJwt().getJwsAlgorithms().get(0)))
.build();
}
}application.yml
spring:
security:
oauth2:
resourceserver:
jwt:
jws-algorithms: HS256SecurityConfig
이전OAuth 2.0 Resource Server MAC & RSA 토큰 검증 - JwtAuthorizationRsaFilter(RSA)다음OAuth 2.0 Resource Server MAC & RSA 토큰 검증 - PublicKey.txt 에 의한 검증(RSA)
마지막 업데이트