Skip to content

Commit

Permalink
Rename OIDC expiration-grace property to lifespan-grace
Browse files Browse the repository at this point in the history
  • Loading branch information
sberyozkin committed Apr 20, 2020
1 parent 4b4723d commit 0370e0a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -589,11 +589,14 @@ public static Token fromAudience(String... audience) {
public Optional<List<String>> audience = Optional.empty();

/**
* Expiration grace period in seconds. A token expiration time will be reduced by
* the value of this property before being compared to the current time.
* Life span grace period in seconds.
* When checking token expiry, current time is allowed to be later than token expiration time by at most the configured
* number of seconds.
* When checking token issuance, current time is allowed to be sooner than token issue time by at most the configured
* number of seconds.
*/
@ConfigItem
public Optional<Integer> expirationGrace = Optional.empty();
public Optional<Integer> lifespanGrace = Optional.empty();

/**
* Name of the claim which contains a principal name. By default, the 'upn', 'preferred_username' and `sub` claims are
Expand Down Expand Up @@ -629,12 +632,12 @@ public void setAudience(List<String> audience) {
this.audience = Optional.of(audience);
}

public Optional<Integer> getExpirationGrace() {
return expirationGrace;
public Optional<Integer> getLifespanGrace() {
return lifespanGrace;
}

public void setExpirationGrace(int expirationGrace) {
this.expirationGrace = Optional.of(expirationGrace);
public void setLifespanGrace(int lifespanGrace) {
this.lifespanGrace = Optional.of(lifespanGrace);
}

public Optional<String> getPrincipalClaim() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ private void processSuccessfulAuthentication(RoutingContext context, TenantConfi
.append(COOKIE_DELIM)
.append(result.opaqueRefreshToken()).toString());
long maxAge = result.idToken().getLong("exp") - result.idToken().getLong("iat");
if (configContext.oidcConfig.token.expirationGrace.isPresent()) {
maxAge += configContext.oidcConfig.token.expirationGrace.get();
if (configContext.oidcConfig.token.lifespanGrace.isPresent()) {
maxAge += configContext.oidcConfig.token.lifespanGrace.get();
}
LOG.debugf("Session cookie 'max-age' parameter is set to %d", maxAge);
cookie.setMaxAge(maxAge);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ private TenantConfigContext createTenantContext(Vertx vertx, OidcTenantConfig oi
options.setValidateIssuer(false);
}

if (oidcConfig.getToken().getExpirationGrace().isPresent()) {
if (oidcConfig.getToken().getLifespanGrace().isPresent()) {
JWTOptions jwtOptions = new JWTOptions();
jwtOptions.setLeeway(oidcConfig.getToken().getExpirationGrace().get());
jwtOptions.setLeeway(oidcConfig.getToken().getLifespanGrace().get());
options.setJWTOptions(jwtOptions);
}

Expand Down

0 comments on commit 0370e0a

Please sign in to comment.