From f1691370d6ed756910e29a989275c88ebd748654 Mon Sep 17 00:00:00 2001 From: Ayush Kohli Date: Mon, 23 Aug 2021 23:48:15 -0500 Subject: [PATCH] Closes gh-10222 --- .../springframework/security/oauth2/jwt/NimbusJwtDecoder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoder.java b/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoder.java index de76dae836..5f5a8accc6 100644 --- a/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoder.java +++ b/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoder.java @@ -164,7 +164,7 @@ public final class NimbusJwtDecoder implements JwtDecoder { catch (RemoteKeySourceException ex) { this.logger.trace("Failed to retrieve JWK set", ex); if (ex.getCause() instanceof ParseException) { - throw new JwtException(String.format(DECODING_ERROR_MESSAGE_TEMPLATE, "Malformed Jwk set")); + throw new JwtException(String.format(DECODING_ERROR_MESSAGE_TEMPLATE, "Malformed Jwk set"), ex); } throw new JwtException(String.format(DECODING_ERROR_MESSAGE_TEMPLATE, ex.getMessage()), ex); } @@ -175,7 +175,7 @@ public final class NimbusJwtDecoder implements JwtDecoder { catch (Exception ex) { this.logger.trace("Failed to process JWT", ex); if (ex.getCause() instanceof ParseException) { - throw new BadJwtException(String.format(DECODING_ERROR_MESSAGE_TEMPLATE, "Malformed payload")); + throw new BadJwtException(String.format(DECODING_ERROR_MESSAGE_TEMPLATE, "Malformed payload"), ex); } throw new BadJwtException(String.format(DECODING_ERROR_MESSAGE_TEMPLATE, ex.getMessage()), ex); }