Class JWTIdentifierClaimsValidator
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.oidc.jwt.claims.AbstractClaimsValidator
net.shibboleth.oidc.security.jwt.claims.impl.JWTIdentifierClaimsValidator
- All Implemented Interfaces:
ClaimsValidator,Component,DestructableComponent,IdentifiableComponent,IdentifiedComponent,InitializableComponent
Verifies the identifier (jit) from the JWT against replay via configurable
ReplayCache.
Single identifier is stored in the cache for the lifetime of the JWT (expiration instant is taken from the 'exp' -claim if found, with configurable default and maximum lifetime).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DurationClock skew adjustment in both directions to consider still acceptable (Default value: 1 minute).private DurationMaximum lifetime to be used in replay cache when 'exp' claim is exploited.private ReplayCacheMessage replay cache instance to use.Optional function to calculate they key used withReplayCache.private DurationStatic lifetime to be used in replay cache if claims set doesn't contain expiration value. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voiddoValidate(JWTClaimsSet claims, ProfileRequestContext context) Perform validation of the given claims supported by the supplied context.voidsetClockSkew(Duration skew) Set the clock skew.voidsetMaxReplayCacheRecordLifetime(Duration lifetime) Set the maximum lifetime to be used in replay cache when 'exp' claim is exploited.voidsetReplayCache(ReplayCache cache) Set the replay cache instance to use.voidsetReplayCacheKeyCalculationStrategy(Function<String, String> strategy) Set the function to calculate they key used withReplayCache.voidsetReplayCacheRecordLifetime(Duration lifetime) Set the static lifetime to be used in replay cache if claims set doesn't contain expiration value.Methods inherited from class net.shibboleth.oidc.jwt.claims.AbstractClaimsValidator
setActivationCondition, validateMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentExceptionMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.IdentifiableComponent
setIdMethods inherited from interface net.shibboleth.shared.component.IdentifiedComponent
getId
-
Field Details
-
replayCache
Message replay cache instance to use. -
clockSkew
Clock skew adjustment in both directions to consider still acceptable (Default value: 1 minute). -
replayCacheRecordLifetime
Static lifetime to be used in replay cache if claims set doesn't contain expiration value. -
maxReplayCacheRecordLifetime
Maximum lifetime to be used in replay cache when 'exp' claim is exploited. -
replayCacheKeyCalculationStrategy
Optional function to calculate they key used withReplayCache.
-
-
Constructor Details
-
JWTIdentifierClaimsValidator
public JWTIdentifierClaimsValidator()Constructor.
-
-
Method Details
-
setReplayCache
Set the replay cache instance to use.- Parameters:
cache- replay cache to set.
-
setClockSkew
Set the clock skew.- Parameters:
skew- clock skew to set.
-
setReplayCacheRecordLifetime
Set the static lifetime to be used in replay cache if claims set doesn't contain expiration value.- Parameters:
lifetime- record lifetime to set.- Since:
- 3.2.0
-
setMaxReplayCacheRecordLifetime
Set the maximum lifetime to be used in replay cache when 'exp' claim is exploited.- Parameters:
lifetime- record lifetime to set.- Since:
- 3.2.0
-
setReplayCacheKeyCalculationStrategy
Set the function to calculate they key used withReplayCache.- Parameters:
strategy- function to set.- Since:
- 3.2.0
-
doInitialize
- Overrides:
doInitializein classAbstractIdentifiedInitializableComponent- Throws:
ComponentInitializationException
-
doValidate
protected void doValidate(@Nonnull JWTClaimsSet claims, @Nullable ProfileRequestContext context) throws JWTValidationException Perform validation of the given claims supported by the supplied context.- Specified by:
doValidatein classAbstractClaimsValidator- Parameters:
claims- the claims to validate.context- the profile request context.- Throws:
JWTValidationException- when validation is unsuccessful due to a failed attempt
-