From d6f5900092fe0fe1283897ca60610a2c85dfc658 Mon Sep 17 00:00:00 2001 From: Tanvi Prasad Date: Wed, 4 Sep 2024 13:54:33 +0530 Subject: [PATCH] jwt leeway time added --- .../resource/server/authenticator/AuthenticationVerticle.java | 3 ++- .../java/iudx/resource/server/authenticator/Constants.java | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/iudx/resource/server/authenticator/AuthenticationVerticle.java b/src/main/java/iudx/resource/server/authenticator/AuthenticationVerticle.java index acae96d39..555c689c6 100644 --- a/src/main/java/iudx/resource/server/authenticator/AuthenticationVerticle.java +++ b/src/main/java/iudx/resource/server/authenticator/AuthenticationVerticle.java @@ -75,6 +75,7 @@ public void start() throws Exception { binder = new ServiceBinder(vertx); JWTAuthOptions jwtAuthOptions = new JWTAuthOptions(); + jwtAuthOptions.getJWTOptions().setLeeway(30); jwtAuthOptions.addPubSecKey( new PubSecKeyOptions().setAlgorithm("ES256").setBuffer(cert)); /* @@ -84,7 +85,7 @@ public void start() throws Exception { config().getBoolean("jwtIgnoreExpiry") != null && config().getBoolean("jwtIgnoreExpiry"); if (jwtIgnoreExpiry) { - jwtAuthOptions.getJWTOptions().setIgnoreExpiration(true); + jwtAuthOptions.getJWTOptions().setIgnoreExpiration(true).setLeeway(30); LOGGER.warn( "JWT ignore expiration set to true, " + "do not set IgnoreExpiration in production!!"); diff --git a/src/main/java/iudx/resource/server/authenticator/Constants.java b/src/main/java/iudx/resource/server/authenticator/Constants.java index 8d85d59e7..90fd2ef2e 100644 --- a/src/main/java/iudx/resource/server/authenticator/Constants.java +++ b/src/main/java/iudx/resource/server/authenticator/Constants.java @@ -63,4 +63,5 @@ public class Constants { public static final String DID = "did"; public static final String REVOKED_CLIENT_SQL = "SELECT * FROM revoked_tokens WHERE _id='$1'"; + public static final int JWT_LEEWAY_TIME = 30; }