Class UsernameLookupFromHttpRequest

All Implemented Interfaces:
Function<ProfileRequestContext,String>, Component, DestructableComponent, IdentifiableComponent, IdentifiedComponent, InitializableComponent

@ThreadSafeAfterInit public class UsernameLookupFromHttpRequest extends AbstractIdentifiableInitializableComponent implements Function<ProfileRequestContext,String>
Extract a username from the HTTP request, returning null if not found.
  • Field Details

    • usernameFieldName

      @Nonnull @NotEmpty private String usernameFieldName
      Form parameter name to carry username.
    • httpServletRequestSupplier

      @Nullable private NonnullSupplier<HttpServletRequest> httpServletRequestSupplier
      Supplier for the Current HTTP request, if available.
  • Constructor Details

    • UsernameLookupFromHttpRequest

      public UsernameLookupFromHttpRequest()
      Constructor.
  • Method Details

    • getHttpServletRequest

      @Nullable public HttpServletRequest getHttpServletRequest()
      Get the current HTTP request if available.
      Returns:
      current HTTP request
    • setHttpServletRequestSupplier

      public void setHttpServletRequestSupplier(@Nullable NonnullSupplier<HttpServletRequest> requestSupplier)
      Set the current HTTP request Supplier.
      Parameters:
      requestSupplier - Supplier for the current HTTP request
    • setUsernameFieldName

      public void setUsernameFieldName(@Nonnull String name)
      Sets the name of the form field to carry the username.
      Parameters:
      name - field name
    • apply

      public String apply(@Nullable ProfileRequestContext prc)
      Specified by:
      apply in interface Function<ProfileRequestContext,String>