Skip to content

Commit 44f22ee

Browse files
committed
Merge branch '5.8.x' into 6.1.x
Closes gh-14495
2 parents ce5f5e6 + ca10187 commit 44f22ee

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

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

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 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.
@@ -144,20 +144,17 @@ public void setClaimSetConverter(Converter<Map<String, Object>, Map<String, Obje
144144
}
145145

146146
@Override
147-
public Mono<Jwt> decode(String token) throws JwtException {
148-
JWT jwt = parse(token);
149-
if (jwt instanceof PlainJWT) {
150-
throw new BadJwtException("Unsupported algorithm of " + jwt.getHeader().getAlgorithm());
151-
}
152-
return this.decode(jwt);
153-
}
154-
155-
private JWT parse(String token) {
147+
public Mono<Jwt> decode(String token) {
156148
try {
157-
return JWTParser.parse(token);
149+
JWT jwt = JWTParser.parse(token);
150+
if (jwt instanceof PlainJWT) {
151+
return Mono.error(new BadJwtException("Unsupported algorithm of " + jwt.getHeader().getAlgorithm()));
152+
}
153+
return this.decode(jwt);
158154
}
159155
catch (Exception ex) {
160-
throw new BadJwtException("An error occurred while attempting to decode the Jwt: " + ex.getMessage(), ex);
156+
return Mono.error(new BadJwtException(
157+
"An error occurred while attempting to decode the Jwt: " + ex.getMessage(), ex));
161158
}
162159
}
163160

0 commit comments

Comments
 (0)