Class Jwt.ExpirationValidator

  • All Implemented Interfaces:
    Validator<Jwt>
    Enclosing class:
    Jwt

    public static final class Jwt.ExpirationValidator
    extends Object
    implements Validator<Jwt>
    Validator of expiration claim.
    • Method Detail

      • create

        public static Jwt.ExpirationValidator create()
        New instance with default values (allowed time skew 5 seconds, optional).
        Returns:
        expiration time validator with defaults
      • create

        public static Jwt.ExpirationValidator create​(boolean mandatory)
        New instance with default values (allowed time skew 5 seconds).
        Parameters:
        mandatory - if this value is mandatory or not
        Returns:
        expiration time validator with defaults
      • create

        public static Jwt.ExpirationValidator create​(Instant now,
                                                     int allowedTimeSkew,
                                                     TemporalUnit allowedTimeSkewUnit,
                                                     boolean mandatory)
        New instance with explicit values.
        Parameters:
        now - time to validate against (to be able to validate past tokens)
        allowedTimeSkew - allowed time skew amount (such as 5)
        allowedTimeSkewUnit - allowed time skew unit (such as ChronoUnit.SECONDS
        mandatory - true for mandatory, false for optional
        Returns:
        expiration time validator