Class TOTPCredentialValidator
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.idp.authn.AbstractCredentialValidator
net.shibboleth.idp.plugin.authn.totp.impl.TOTPCredentialValidator
- All Implemented Interfaces:
net.shibboleth.idp.authn.CredentialValidator,net.shibboleth.idp.authn.principal.PrincipalSupportingComponent,Component,DestructableComponent,IdentifiableComponent,IdentifiedComponent,InitializableComponent
public class TOTPCredentialValidator
extends net.shibboleth.idp.authn.AbstractCredentialValidator
A
CredentialValidator that checks for a TOTPContext.-
Nested Class Summary
Nested classes/interfaces inherited from interface net.shibboleth.idp.authn.CredentialValidator
net.shibboleth.idp.authn.CredentialValidator.ErrorHandler, net.shibboleth.idp.authn.CredentialValidator.WarningHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate TOTPAuthenticatorTOTP implementation.private static final StringDefault prefix for metrics.private final org.slf4j.LoggerClass logger.private PatternA regular expression to apply for acceptance testing.private Consumer<ProfileRequestContext>Source of token seeds.private Function<net.shibboleth.idp.authn.context.AuthenticationContext,TOTPContext> Lookup strategy for TOTP context. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected SubjectdoValidate(ProfileRequestContext profileRequestContext, net.shibboleth.idp.authn.context.AuthenticationContext authenticationContext, net.shibboleth.idp.authn.CredentialValidator.WarningHandler warningHandler, net.shibboleth.idp.authn.CredentialValidator.ErrorHandler errorHandler) protected SubjectpopulateSubject(Subject subject, ProfileRequestContext profileRequestContext, TOTPContext totpContext) Decorate the subject with "standard" content from the validation.voidSet TOTP implementation to use.voidsetMatchExpression(Pattern expression) Set a matching expression to apply to the username for acceptance.voidsetSeedSource(Consumer<ProfileRequestContext> source) Set source of token seeds.voidsetTOTPContextLookupStrategy(Function<net.shibboleth.idp.authn.context.AuthenticationContext, TOTPContext> strategy) Set the lookup strategy to locate theTOTPContext.Methods inherited from class net.shibboleth.idp.authn.AbstractCredentialValidator
getLogPrefix, getSupportedPrincipals, isAcceptable, populateSubject, setActivationCondition, setId, setSupportedPrincipals, validateMethods 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.IdentifiedComponent
getId
-
Field Details
-
DEFAULT_METRIC_NAME
Default prefix for metrics.- See Also:
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
totpContextLookupStrategy
@Nonnull private Function<net.shibboleth.idp.authn.context.AuthenticationContext,TOTPContext> totpContextLookupStrategyLookup strategy for TOTP context. -
authenticator
TOTP implementation. -
seedSource
Source of token seeds. -
matchExpression
A regular expression to apply for acceptance testing.
-
-
Constructor Details
-
TOTPCredentialValidator
public TOTPCredentialValidator()Constructor.
-
-
Method Details
-
setTOTPContextLookupStrategy
public void setTOTPContextLookupStrategy(@Nonnull Function<net.shibboleth.idp.authn.context.AuthenticationContext, TOTPContext> strategy) Set the lookup strategy to locate theTOTPContext.- Parameters:
strategy- lookup strategy
-
setAuthenticator
Set TOTP implementation to use.- Parameters:
impl- TOTP implementation
-
setSeedSource
Set source of token seeds.- Parameters:
source- seed source
-
setMatchExpression
Set a matching expression to apply to the username for acceptance.- Parameters:
expression- a matching expression
-
doInitialize
- Overrides:
doInitializein classAbstractIdentifiedInitializableComponent- Throws:
ComponentInitializationException
-
doValidate
protected Subject doValidate(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull net.shibboleth.idp.authn.context.AuthenticationContext authenticationContext, @Nullable net.shibboleth.idp.authn.CredentialValidator.WarningHandler warningHandler, @Nullable net.shibboleth.idp.authn.CredentialValidator.ErrorHandler errorHandler) throws Exception - Specified by:
doValidatein classnet.shibboleth.idp.authn.AbstractCredentialValidator- Throws:
Exception
-
populateSubject
@Nonnull protected Subject populateSubject(@Nonnull Subject subject, @Nonnull ProfileRequestContext profileRequestContext, @Nonnull TOTPContext totpContext) Decorate the subject with "standard" content from the validation.- Parameters:
subject- the subject being returnedprofileRequestContext- current profile request contexttotpContext- the TOTP context being validated- Returns:
- the decorated subject
-