Class JwtTimestampValidator
java.lang.Object
org.springframework.security.oauth2.jwt.JwtTimestampValidator
- All Implemented Interfaces:
org.springframework.security.oauth2.core.OAuth2TokenValidator<Jwt>
public final class JwtTimestampValidator
extends Object
implements org.springframework.security.oauth2.core.OAuth2TokenValidator<Jwt>
An implementation of
OAuth2TokenValidator for verifying claims in a Jwt-based
access token
Because clocks can differ between the Jwt source, say the Authorization Server, and its destination, say the Resource Server, there is a default clock leeway exercised when deciding if the current time is within the Jwt's specified operating window
- Since:
- 5.1
- See Also:
-
JwtOAuth2TokenValidator- JSON Web Token (JWT)
-
Constructor Summary
ConstructorsConstructorDescriptionA basic instance with no custom verification and the default max clock skewJwtTimestampValidator(Duration clockSkew) -
Method Summary
Modifier and TypeMethodDescriptionvoidsetAllowEmptyExpiryClaim(boolean allowEmptyExpiryClaim) Whether to allow theexpheader to be empty.voidsetAllowEmptyNotBeforeClaim(boolean allowEmptyNotBeforeClaim) Whether to allow thenbfheader to be empty.voidUse thisClockwithInstant.now()for assessing timestamp validityorg.springframework.security.oauth2.core.OAuth2TokenValidatorResult
-
Constructor Details
-
JwtTimestampValidator
public JwtTimestampValidator()A basic instance with no custom verification and the default max clock skew -
JwtTimestampValidator
-
-
Method Details
-
setAllowEmptyExpiryClaim
public void setAllowEmptyExpiryClaim(boolean allowEmptyExpiryClaim) Whether to allow theexpheader to be empty. The default value istrue- Since:
- 7.0
-
setAllowEmptyNotBeforeClaim
public void setAllowEmptyNotBeforeClaim(boolean allowEmptyNotBeforeClaim) Whether to allow thenbfheader to be empty. The default value istrue- Since:
- 7.0
-
validate
- Specified by:
validatein interfaceorg.springframework.security.oauth2.core.OAuth2TokenValidator<Jwt>
-
setClock
Use thisClockwithInstant.now()for assessing timestamp validity- Parameters:
clock-
-