public AbstractSecurityToken enforceNotExpired() throws BlobExpiredException { Long expiresAt = getExpiresAt(); if (expiresAt != null) { long maxTime = expiresAt + CLOCK_SKEW_ALLOWANCE; long now = getTimeSource().currentTimeMillis() / 1000; if (!(now < maxTime)) { throw new BlobExpiredException(now, maxTime); } } return this; }
/** * Compute and set the expiration time for this token using the provided TTL. * * @param tokenTTL the time to live (in seconds) of the token * @return This security token. */ protected AbstractSecurityToken setExpires(int tokenTTL) { this.tokenTTL = tokenTTL; return setExpiresAt((getTimeSource().currentTimeMillis() / 1000) + getMaxTokenTTL()); }
/** * Compute and set the expiration time for this token using the provided TTL. * * @param tokenTTL the time to live (in seconds) of the token * @return This security token. */ protected AbstractSecurityToken setExpires(int tokenTTL) { this.tokenTTL = tokenTTL; return setExpiresAt((getTimeSource().currentTimeMillis() / 1000) + getMaxTokenTTL()); }
public AbstractSecurityToken enforceNotExpired() throws BlobExpiredException { Long expiresAt = getExpiresAt(); if (expiresAt != null) { long maxTime = expiresAt + CLOCK_SKEW_ALLOWANCE; long now = getTimeSource().currentTimeMillis() / 1000; if (!(now < maxTime)) { throw new BlobExpiredException(now, maxTime); } } return this; }
/** * Compute and set the expiration time for this token using the provided TTL. * * @param tokenTTL the time to live (in seconds) of the token * @return This security token. */ protected AbstractSecurityToken setExpires(int tokenTTL) { this.tokenTTL = tokenTTL; return setExpiresAt((getTimeSource().currentTimeMillis() / 1000) + getMaxTokenTTL()); }
public AbstractSecurityToken enforceNotExpired() throws BlobExpiredException { Long expiresAt = getExpiresAt(); if (expiresAt != null) { long maxTime = expiresAt + CLOCK_SKEW_ALLOWANCE; long now = getTimeSource().currentTimeMillis() / 1000; if (!(now < maxTime)) { throw new BlobExpiredException(now, maxTime); } } return this; }