Class PasswordErrorMessageLookupFunction

java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
net.shibboleth.idp.authn.context.navigate.PasswordErrorMessageLookupFunction
All Implemented Interfaces:
Function<ProfileRequestContext,String>, ContextDataLookupFunction<ProfileRequestContext,String>, Aware, ApplicationContextAware

public class PasswordErrorMessageLookupFunction extends ApplicationObjectSupport implements ContextDataLookupFunction<ProfileRequestContext,String>
A function that examines the state of a request and produces an appropriate error message for the Password login flow.

NOTE: The result of this function is NOT HTML-encoded in any way and must be encoded for safety if used.

This implements the pre-existing default behavior in Velocity for determining an error to display.

Since:
5.1.0
  • Field Details

    • genericMessageID

      private String genericMessageID
      Message ID to use for generic, unclassified errors or exceptions.
  • Constructor Details

    • PasswordErrorMessageLookupFunction

      public PasswordErrorMessageLookupFunction()
  • Method Details

    • setGenericMessageID

      public void setGenericMessageID(@Nullable String id)
      Sets whether non-message-based error messages should be exposed or turned into a more generic value.
      Parameters:
      id - message ID
    • apply

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

      @Nullable private String getClassifiedMessage(@Nonnull MessageSourceAccessor messageSource, @Nonnull String classifiedError)
      Get classified message.
      Parameters:
      messageSource - Spring message source
      classifiedError - classified error event
      Returns:
      mapped message, or null
    • getExceptionMessage

      @Nullable private String getExceptionMessage(@Nonnull MessageSourceAccessor messageSource, @Nonnull Exception e)
      Get generic error message or exception message.
      Parameters:
      messageSource - Spring message source
      e - exception
      Returns:
      the exception message or the generic message as appropriate