Class AuthenticationTimeClaimsValidator
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
-
- net.shibboleth.utilities.java.support.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
@ThreadSafeAfterInit public class AuthenticationTimeClaimsValidator extends AbstractClaimsValidator
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
Fields Modifier and Type Field Description private Function<ProfileRequestContext,Duration>authnLifetimeLookupStrategyLookup strategy to find the amount of time for which a token is valid after if it was first issued.private Function<ProfileRequestContext,Instant>authnRequestTimeLookupStrategyLookup strategy to find the time at which the authentication request was made.private DurationclockSkewPositive clock skew adjustment to consider when checking auth_time is not in the future or has expired.private org.slf4j.LoggerlogClass logger.private Predicate<ProfileRequestContext>requestedHas the auth_time been requested, either explicitly or from the max_age parameter? Defaults to true.
-
Constructor Summary
Constructors Constructor Description AuthenticationTimeClaimsValidator()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voiddoValidate(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.voidsetAuthnLifetimeLookupStrategy(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.voidsetAuthnRequestTimeLookupStrategy(Function<ProfileRequestContext,Instant> strategy)Set 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, validate
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
setId
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
doInitialize, getId
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, initialize, isDestroyed, isInitialized
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.shibboleth.utilities.java.support.component.IdentifiableComponent
setId
-
Methods inherited from interface net.shibboleth.utilities.java.support.component.IdentifiedComponent
getId
-
-
-
-
Field Detail
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
authnLifetimeLookupStrategy
@Nonnull private Function<ProfileRequestContext,Duration> 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
@Nonnull private Function<ProfileRequestContext,Instant> authnRequestTimeLookupStrategy
Lookup strategy to find the time at which the authentication request was made. Defaults to now minus the clockskew.
-
clockSkew
@Nonnull private Duration clockSkew
Positive clock skew adjustment to consider when checking auth_time is not in the future or has expired. (Default value: 60 seconds).
-
requested
@Nonnull private Predicate<ProfileRequestContext> requested
Has the auth_time been requested, either explicitly or from the max_age parameter? Defaults to true.
-
-
Method Detail
-
setClockSkew
public void setClockSkew(@Nonnull Duration skew)Set the clock skew.- Parameters:
skew- clock skew to set
-
setAuthnRequestTimeLookupStrategy
public void setAuthnRequestTimeLookupStrategy(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(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
public void setAuthnLifetime(@Nonnull Duration lifetime)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
-
-