Class ExpiryClaimsValidator

All Implemented Interfaces:
ClaimsValidator, Component, DestructableComponent, IdentifiableComponent, IdentifiedComponent, InitializableComponent

@ThreadSafeAfterInit public class ExpiryClaimsValidator extends AbstractClaimsValidator
Iff an expiration time (exp) claim is present, verifies that it is ahead of the current time, else the JWT claims set is rejected. A few minutes of clockSkew is allowed. See section 3.1.3.7 of OpenID Connect core 1.0.
  • Field Details

    • clockSkew

      @Nonnull private Duration clockSkew
      Positive clock skew adjustment to consider when checking JWT expiration (Default value: 60 seconds).
  • Constructor Details

    • ExpiryClaimsValidator

      public ExpiryClaimsValidator()
      Constructor.
  • Method Details

    • setClockSkew

      public void setClockSkew(@Nonnull Duration skew)
      Set the clock skew.
      Parameters:
      skew - clock skew to set
    • doValidate

      public void doValidate(@Nonnull com.nimbusds.jwt.JWTClaimsSet claims, @Nonnull ProfileRequestContext context) throws JWTValidationException
      Perform validation of the given claims supported by the supplied context.
      Specified by:
      doValidate in class AbstractClaimsValidator
      Parameters:
      claims - the claims to validate.
      context - the profile request context.
      Throws:
      JWTValidationException - when validation is unsuccessful due to a failed attempt