Class ExtractUsernameFromForm

All Implemented Interfaces:
Component, DestructableComponent, InitializableComponent, ProfileAction, Aware, MessageSource, MessageSourceAware, Action

public class ExtractUsernameFromForm extends AbstractExtractionAction
An action to populate a username into the BaseWebAuthnContext.
Event:
AuthnEventIds.UNKNOWN_USERNAME
Precondition:
ProfileRequestContext.getSubcontext(AuthenticationContext.class) != null
Postcondition:
BaseWebAuthnContext.getUsername() == null
  • Field Details

  • Constructor Details

    • ExtractUsernameFromForm

      public ExtractUsernameFromForm()
      Constructor.
  • Method Details

    • setWebAuthnContextLookupStrategy

      public void setWebAuthnContextLookupStrategy(@Nonnull Function<ProfileRequestContext,BaseWebAuthnContext> strategy)
      Set the strategy used to locate the BaseWebAuthnContext to operate on.
      Parameters:
      strategy - lookup strategy
    • setUsernameFieldName

      public void setUsernameFieldName(@Nonnull String name)
      Sets the name of the form field that carries the username.
      Parameters:
      name - field name
    • setSSOBypassFieldName

      public void setSSOBypassFieldName(@Nonnull @NotEmpty String fieldName)
      Set the SSO bypass parameter name.
      Parameters:
      fieldName - the SSO bypass parameter name
    • doPreExecute

      protected boolean doPreExecute(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthenticationContext authenticationContext)
      Overrides:
      doPreExecute in class AbstractAuthenticationAction
    • doExecute

      protected void doExecute(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthenticationContext authenticationContext)
      Overrides:
      doExecute in class AbstractAuthenticationAction
    • getUsernameFromForm

      @Nullable private String getUsernameFromForm()
      Gets the username from a form submission.
      Returns:
      the raw submitted username
    • processFormSubmission

      @Nullable private String processFormSubmission(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthenticationContext authenticationContext)
      Process the form submission: extract and transform the username, processes do-not-cache instruction.
      Parameters:
      profileRequestContext - profile request context
      authenticationContext - authentication context
      Returns:
      the submitted username, after applying any configured transforms