Skip to content

Commit

Permalink
Merge pull request datakaveri#181 from tanvi029/jwt-leeway
Browse files Browse the repository at this point in the history
jwt-leeway-added
  • Loading branch information
Gokul-KG authored Sep 4, 2024
2 parents 1e6fe50 + 8c3d744 commit ae1e71e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public void start() {
JWTAuthOptions jwtAuthOptions = new JWTAuthOptions();
jwtAuthOptions.addPubSecKey(
new PubSecKeyOptions().setAlgorithm("ES256").setBuffer(cert));
jwtAuthOptions.getJWTOptions().setLeeway(JWT_LEEWAY_TIME);
/*
* Default jwtIgnoreExpiry is false. If set through config, then that value is taken
*/
Expand All @@ -67,7 +68,7 @@ public void start() {
? false
: config().getBoolean("jwtIgnoreExpiry");
if (jwtIgnoreExpiry) {
jwtAuthOptions.getJWTOptions().setIgnoreExpiration(true);
jwtAuthOptions.getJWTOptions().setIgnoreExpiration(true).setLeeway(JWT_LEEWAY_TIME);
LOGGER.warn(
"JWT ignore expiration set to true,"
+ "do not set IgnoreExpiration in production!!");
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/iudx/file/server/common/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,6 @@ public class Constants {
ITEM_TYPE_RESOURCE_GROUP,
ITEM_TYPE_RESOURCE_SERVER,
ITEM_TYPE_PROVIDER));
public static final int JWT_LEEWAY_TIME = 30;

}

0 comments on commit ae1e71e

Please sign in to comment.