Skip to content

Commit 69e33d6

Browse files
Michael Kreissnicoll
authored andcommitted
Configure signature algorithm when using public key jwt decoder
See gh-20523
1 parent a2d70d4 commit 69e33d6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerJwtConfiguration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ JwtDecoder jwtDecoderByJwkKeySetUri() {
7878
JwtDecoder jwtDecoderByPublicKeyValue() throws Exception {
7979
RSAPublicKey publicKey = (RSAPublicKey) KeyFactory.getInstance("RSA")
8080
.generatePublic(new X509EncodedKeySpec(getKeySpec(this.properties.readPublicKey())));
81-
return NimbusJwtDecoder.withPublicKey(publicKey).build();
81+
return NimbusJwtDecoder.withPublicKey(publicKey)
82+
.signatureAlgorithm(SignatureAlgorithm.from(this.properties.getJwsAlgorithm())).build();
8283
}
8384

8485
private byte[] getKeySpec(String keyValue) {

0 commit comments

Comments
 (0)