Skip to content

Commit 97f4e2c

Browse files
authored
Merge pull request #140 from syntheshad/jwt-verify-unhandled-exception-fix
Update JwtVerifyMiddleware to handle VerificationException
2 parents 833eae7 + f81f052 commit 97f4e2c

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)