Skip to content

Commit 08a89b6

Browse files
committed
Polish "Configure signature algorithm when using public key jwt decoder"
See gh-20523
1 parent 69e33d6 commit 08a89b6

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerAutoConfigurationTests.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -190,6 +190,16 @@ void autoConfigurationShouldFailIfPublicKeyLocationDoesNotExist() {
190190
.hasMessageContaining("Public key location does not exist"));
191191
}
192192

193+
@Test
194+
void autoConfigurationShouldFailIfAlgorithmIsInvalid() {
195+
this.contextRunner
196+
.withPropertyValues(
197+
"spring.security.oauth2.resourceserver.jwt.public-key-location=classpath:public-key-location",
198+
"spring.security.oauth2.resourceserver.jwt.jws-algorithm=NOT_VALID")
199+
.run((context) -> assertThat(context).hasFailed().getFailure()
200+
.hasMessageContaining("signatureAlgorithm cannot be null"));
201+
}
202+
193203
@Test
194204
void autoConfigurationWhenSetUriKeyLocationAndIssuerUriPresentShouldUseSetUri() {
195205
this.contextRunner

0 commit comments

Comments
 (0)