Configure signature algorithm when using public key jwt decoder

See gh-20523
This commit is contained in:
Michael Kreis
2020-03-13 13:01:02 +01:00
committed by Stephane Nicoll
parent a2d70d46e1
commit 69e33d6e62

View File

@@ -78,7 +78,8 @@ class OAuth2ResourceServerJwtConfiguration {
JwtDecoder jwtDecoderByPublicKeyValue() throws Exception {
RSAPublicKey publicKey = (RSAPublicKey) KeyFactory.getInstance("RSA")
.generatePublic(new X509EncodedKeySpec(getKeySpec(this.properties.readPublicKey())));
return NimbusJwtDecoder.withPublicKey(publicKey).build();
return NimbusJwtDecoder.withPublicKey(publicKey)
.signatureAlgorithm(SignatureAlgorithm.from(this.properties.getJwsAlgorithm())).build();
}
private byte[] getKeySpec(String keyValue) {