Class OidcIdTokenValidator

  • All Implemented Interfaces:
    org.springframework.security.oauth2.core.OAuth2TokenValidator<org.springframework.security.oauth2.jwt.Jwt>

    public final class OidcIdTokenValidator
    extends java.lang.Object
    implements org.springframework.security.oauth2.core.OAuth2TokenValidator<org.springframework.security.oauth2.jwt.Jwt>
    An OAuth2TokenValidator responsible for validating the claims in an ID Token.
    Since:
    5.1
    See Also:
    OAuth2TokenValidator, Jwt, ID Token Validation
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void setClock​(java.time.Clock clock)
      Sets the Clock used in Instant.now(Clock) when validating the exp and iat claims.
      void setClockSkew​(java.time.Duration clockSkew)
      Sets the maximum acceptable clock skew.
      org.springframework.security.oauth2.core.OAuth2TokenValidatorResult validate​(org.springframework.security.oauth2.jwt.Jwt idToken)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OidcIdTokenValidator

        public OidcIdTokenValidator​(ClientRegistration clientRegistration)
    • Method Detail

      • validate

        public org.springframework.security.oauth2.core.OAuth2TokenValidatorResult validate​(org.springframework.security.oauth2.jwt.Jwt idToken)
        Specified by:
        validate in interface org.springframework.security.oauth2.core.OAuth2TokenValidator<org.springframework.security.oauth2.jwt.Jwt>
      • setClockSkew

        public void setClockSkew​(java.time.Duration clockSkew)
        Sets the maximum acceptable clock skew. The default is 60 seconds. The clock skew is used when validating the exp and iat claims.
        Parameters:
        clockSkew - the maximum acceptable clock skew
        Since:
        5.2
      • setClock

        public void setClock​(java.time.Clock clock)
        Sets the Clock used in Instant.now(Clock) when validating the exp and iat claims.
        Parameters:
        clock - the clock
        Since:
        5.3