Class AuthenticationTimeClaimsValidator
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.AuthenticationTimeClaimsValidator
- All Implemented Interfaces:
ClaimsValidator,Component,DestructableComponent,IdentifiableComponent,IdentifiedComponent,InitializableComponent
Verifies the auth_time (when the End-User authentication took place):
- If the authnLifetimeLookup returns 0 seconds (e.g. max_age=0), assume the 'forced authentication' semantic, and check the auth_time is after the authentication request time.
- Or, if the authnLifetimeLookup returns a value >0, check the authentication occurred within a valid expiration window.
A predicate determines if the auth_time was requested e.g. was explicitly requested, or the max_age claim was set. Defaults to true.
-
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.private Predicate<ProfileRequestContext>Has the auth_time been requested, either explicitly or from the max_age parameter? Defaults to true. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddoValidate(JWTClaimsSet claimsSet, ProfileRequestContext context) Perform validation of the given claims supported by the supplied 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.voidsetRequested(Predicate<ProfileRequestContext> isRequested) Deprecated, for removal: This API element is subject to removal in a future version.use the activation condition in the base class instead.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). -
requested
Has the auth_time been requested, either explicitly or from the max_age parameter? Defaults to true.
-
-
Constructor Details
-
AuthenticationTimeClaimsValidator
public AuthenticationTimeClaimsValidator()Constructor.
-
-
Method Details
-
setClockSkew
Set the clock skew.- Parameters:
skew- clock skew to set
-
setAuthnRequestTimeLookupStrategy
public void setAuthnRequestTimeLookupStrategy(@Nonnull Function<ProfileRequestContext, Instant> strategy) Set the lookup strategy to find out when the authentication request (if any) was made.- Parameters:
strategy- the strategy- Since:
- 2.2.0
-
setRequested
@Deprecated(forRemoval=true, since="2.2.0") public void setRequested(@Nonnull Predicate<ProfileRequestContext> isRequested) Deprecated, for removal: This API element is subject to removal in a future version.use the activation condition in the base class instead.Has the auth_time been request e.g. explicitly, or by using the max_age parameter.- Parameters:
isRequested- has auth_time been requested.
-
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 JWTClaimsSet claimsSet, @Nonnull ProfileRequestContext context) throws JWTValidationException Description copied from class:AbstractClaimsValidatorPerform validation of the given claims supported by the supplied context.- Specified by:
doValidatein classAbstractClaimsValidator- Parameters:
claimsSet- the claims to validate.context- the profile request context.- Throws:
JWTValidationException- when validation is unsuccessful due to a failed attempt
-