Class DuoAuthenticationTimeClaimsValidator
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.idp.plugin.authn.duo.impl.DuoAuthenticationTimeClaimsValidator
- All Implemented Interfaces:
ClaimsValidator,Component,DestructableComponent,IdentifiableComponent,IdentifiedComponent,InitializableComponent
A Duo specific version of the
AuthenticationTimeClaimsValidator that performs the same logic but
does not throw an error if the setAuthnLifetimeLookupStrategy(java.util.function.Function)
returns null, instead it ignores the check.
The logic defined by this validator depends on the result of the authnLifetimeLookupStrategy. That is:
-
A
nulllifetime indicates that authentication time validation should not be enforced. -
A lifetime of
Duration.ZEROindicates that fresh authentication is required. In this case, theauth_timevalue must be later than the time at which the authentication request was made. -
A positive lifetime indicates the maximum permitted age of the
authentication. In this case, the
auth_timevalue must fall within the specified lifetime window, subject to any configured clock skew allowance.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Function<ProfileRequestContext,Duration> Lookup strategy to find the amount of time for which a token is valid after if it was first issued.private Function<ProfileRequestContext,Instant> Lookup strategy to find the time at which the authentication request was made.private DurationPositive clock skew adjustment to consider when checking auth_time is not in the future or has expired.private final org.slf4j.LoggerClass logger. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddoValidate(com.nimbusds.jwt.JWTClaimsSet claimsSet, ProfileRequestContext context) voidsetAuthnLifetime(Duration lifetime) Sets the amount of time for which a token is valid from when the original authentication took place.voidSet the lookup strategy used to locate the amount of time for which a token is valid from when the original authentication took place.voidSet the lookup strategy to find out when the authentication request (if any) was made.voidsetClockSkew(Duration skew) Set the clock skew.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
doInitialize, 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
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
authnLifetimeLookupStrategy
Lookup strategy to find the amount of time for which a token is valid after if it was first issued. (Default value: 60 seconds) -
authnRequestTimeLookupStrategy
Lookup strategy to find the time at which the authentication request was made. Defaults to now minus the clockskew. -
clockSkew
Positive clock skew adjustment to consider when checking auth_time is not in the future or has expired. (Default value: 60 seconds).
-
-
Constructor Details
-
DuoAuthenticationTimeClaimsValidator
public DuoAuthenticationTimeClaimsValidator()Constructor.
-
-
Method Details
-
setClockSkew
Set the clock skew.- Parameters:
skew- clock skew to set
-
setAuthnRequestTimeLookupStrategy
Set the lookup strategy to find out when the authentication request (if any) was made.- Parameters:
strategy- the strategy
-
setAuthnLifetime
Sets the amount of time for which a token is valid from when the original authentication took place.- Parameters:
lifetime- amount of time for which a token is valid
-
setAuthnLifetimeLookupStrategy
public void setAuthnLifetimeLookupStrategy(@Nonnull Function<ProfileRequestContext, Duration> strategy) Set the lookup strategy used to locate the amount of time for which a token is valid from when the original authentication took place.- Parameters:
strategy- the strategy- Since:
- 2.2.0
-
doValidate
public void doValidate(@Nonnull com.nimbusds.jwt.JWTClaimsSet claimsSet, @Nonnull ProfileRequestContext context) throws JWTValidationException - Specified by:
doValidatein classAbstractClaimsValidator- Throws:
JWTValidationException
-