@Override public String toString() { DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG); StringBuilder sb = new StringBuilder(); Date date = new Date(getValueInMillis()); sb.append("NumericDate").append("{").append(getValue()).append(" -> ").append(df.format(date)).append('}'); return sb.toString(); }
@NotNull private static Link createToken( @NotNull SharedContext context, @NotNull URI baseLfsUrl, @NotNull User user, int tokenExpireSec, float tokenEnsureTime ) { int expireSec = tokenExpireSec <= 0 ? LfsConfig.DEFAULT_TOKEN_EXPIRE_SEC : tokenExpireSec; int ensureSec = (int) Math.ceil(expireSec * tokenEnsureTime); NumericDate now = NumericDate.now(); NumericDate expireAt = NumericDate.fromSeconds(now.getValue() + expireSec); NumericDate ensureAt = NumericDate.fromSeconds(now.getValue() + ensureSec); return new Link( baseLfsUrl, createTokenHeader(context, user, expireAt), new Date(ensureAt.getValueInMillis()) ); } }
public long getValueInMillis() { return getValue() * CONVERSION; }
public boolean isBefore(NumericDate when) { return value < when.getValue(); }
public boolean isAfter(NumericDate when) { return value > when.getValue(); }
public void setNumericDateClaim(String claimName, NumericDate value) { claimsMap.put(claimName, value != null ? value.getValue() : null); }
if ((evaluationTime.getValue() - allowedClockSkewSeconds) >= expirationTime.getValue()) long deltaInSeconds = (expirationTime.getValue() - allowedClockSkewSeconds) - evaluationTime.getValue(); if (deltaInSeconds > (maxFutureValidityInMinutes * 60)) if ((evaluationTime.getValue() + allowedClockSkewSeconds) < notBefore.getValue())