/** * Checks if a given instant of time falls into a secret's validity period. * * @param secret The secret to check against. * @param instant The instant of time. * @return {@code true} if the instant falls into the secret's validity period. */ public static boolean isInValidityPeriod(final JsonObject secret, final Instant instant) { final Instant notBefore = CredentialsObject.getNotBefore(secret); final Instant notAfter = CredentialsObject.getNotAfter(secret); return (notBefore == null || instant.isAfter(notBefore)) && (notAfter == null || instant.isBefore(notAfter)); }
/** * Checks if a given instant of time falls into a secret's validity period. * * @param secret The secret to check against. * @param instant The instant of time. * @return {@code true} if the instant falls into the secret's validity period. */ public static boolean isInValidityPeriod(final JsonObject secret, final Instant instant) { final Instant notBefore = CredentialsObject.getNotBefore(secret); final Instant notAfter = CredentialsObject.getNotAfter(secret); return (notBefore == null || instant.isAfter(notBefore)) && (notAfter == null || instant.isBefore(notAfter)); }