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.
  • Field Details

    • DEFAULT_METRIC_NAME

      @Nonnull @NotEmpty private static final String DEFAULT_METRIC_NAME
      Default prefix for metrics.
      See Also:
    • log

      @Nonnull private final org.slf4j.Logger log
      Class logger.
    • totpContextLookupStrategy

      @Nonnull private Function<net.shibboleth.idp.authn.context.AuthenticationContext,TOTPContext> totpContextLookupStrategy
      Lookup strategy for TOTP context.
    • authenticator

      @NonnullAfterInit private TOTPAuthenticator authenticator
      TOTP implementation.
    • seedSource

      Source of token seeds.
    • matchExpression

      @Nullable private Pattern 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 the TOTPContext.
      Parameters:
      strategy - lookup strategy
    • setAuthenticator

      public void setAuthenticator(@Nonnull TOTPAuthenticator impl)
      Set TOTP implementation to use.
      Parameters:
      impl - TOTP implementation
    • setSeedSource

      public void setSeedSource(@Nonnull Consumer<ProfileRequestContext> source)
      Set source of token seeds.
      Parameters:
      source - seed source
    • setMatchExpression

      public void setMatchExpression(@Nullable Pattern expression)
      Set a matching expression to apply to the username for acceptance.
      Parameters:
      expression - a matching expression
    • doInitialize

      protected void doInitialize() throws ComponentInitializationException
      Overrides:
      doInitialize in class AbstractIdentifiedInitializableComponent
      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:
      doValidate in class net.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 returned
      profileRequestContext - current profile request context
      totpContext - the TOTP context being validated
      Returns:
      the decorated subject