Skip to content

Commit f81f052

Browse files
authored
Update JwtVerifyMiddleware.java
Added VerificationException as one of the handled exception for cases such as no kid or kid mismatch between jwt and jwk.
1 parent 7d54715 commit f81f052

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/main/java/com/networknt/aws/lambda/handler/middleware/security/JwtVerifyMiddleware.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,20 @@ public Status handleJwt(LightLambdaExchange exchange, String pathPrefix, String
210210

211211
} catch (MalformedClaimException e) {
212212
LOG.error("MalformedClaimException", e);
213+
213214
if (LOG.isDebugEnabled())
214215
LOG.debug("JwtVerifyHandler.execute ends with an error.");
216+
215217
return new Status(STATUS_INVALID_AUTH_TOKEN);
218+
219+
} catch (VerificationException e) {
220+
LOG.error("VerificationException", e);
221+
222+
if (LOG.isDebugEnabled())
223+
LOG.debug("JwtVerifyHandler.execute ends with an error.");
224+
225+
return new Status(STATUS_INVALID_AUTH_TOKEN);
226+
216227
}
217228
} else {
218229
if (LOG.isDebugEnabled())

0 commit comments

Comments
 (0)