Skip to content

Commit 02ea989

Browse files
jzheauxkostya05983
authored andcommitted
Nimbus JWK Set Configs Take SignatureAlgorithm
Fixes spring-projectsgh-7270
1 parent 6262688 commit 02ea989

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoder.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
import org.springframework.http.ResponseEntity;
5353
import org.springframework.security.oauth2.core.OAuth2TokenValidator;
5454
import org.springframework.security.oauth2.core.OAuth2TokenValidatorResult;
55-
import org.springframework.security.oauth2.jose.jws.JwsAlgorithm;
5655
import org.springframework.security.oauth2.jose.jws.MacAlgorithm;
5756
import org.springframework.security.oauth2.jose.jws.SignatureAlgorithm;
5857
import org.springframework.util.Assert;
@@ -222,12 +221,12 @@ private JwkSetUriJwtDecoderBuilder(String jwkSetUri) {
222221
* Use the given signing
223222
* <a href="https://tools.ietf.org/html/rfc7515#section-4.1.1" target="_blank">algorithm</a>.
224223
*
225-
* @param jwsAlgorithm the algorithm to use
224+
* @param signatureAlgorithm the algorithm to use
226225
* @return a {@link JwkSetUriJwtDecoderBuilder} for further configurations
227226
*/
228-
public JwkSetUriJwtDecoderBuilder jwsAlgorithm(JwsAlgorithm jwsAlgorithm) {
229-
Assert.notNull(jwsAlgorithm, "jwsAlgorithm cannot be null");
230-
this.jwsAlgorithm = JWSAlgorithm.parse(jwsAlgorithm.getName());
227+
public JwkSetUriJwtDecoderBuilder jwsAlgorithm(SignatureAlgorithm signatureAlgorithm) {
228+
Assert.notNull(signatureAlgorithm, "signatureAlgorithm cannot be null");
229+
this.jwsAlgorithm = JWSAlgorithm.parse(signatureAlgorithm.getName());
231230
return this;
232231
}
233232

oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusReactiveJwtDecoder.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,12 @@ private JwkSetUriReactiveJwtDecoderBuilder(String jwkSetUri) {
245245
* Use the given signing
246246
* <a href="https://tools.ietf.org/html/rfc7515#section-4.1.1" target="_blank">algorithm</a>.
247247
*
248-
* @param jwsAlgorithm the algorithm to use
248+
* @param signatureAlgorithm the algorithm to use
249249
* @return a {@link JwkSetUriReactiveJwtDecoderBuilder} for further configurations
250250
*/
251-
public JwkSetUriReactiveJwtDecoderBuilder jwsAlgorithm(JwsAlgorithm jwsAlgorithm) {
252-
Assert.notNull(jwsAlgorithm, "jwsAlgorithm cannot be null");
253-
this.jwsAlgorithm = JWSAlgorithm.parse(jwsAlgorithm.getName());
251+
public JwkSetUriReactiveJwtDecoderBuilder jwsAlgorithm(SignatureAlgorithm signatureAlgorithm) {
252+
Assert.notNull(signatureAlgorithm, "sig cannot be null");
253+
this.jwsAlgorithm = JWSAlgorithm.parse(signatureAlgorithm.getName());
254254
return this;
255255
}
256256

0 commit comments

Comments
 (0)