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 Summary
FieldsModifier and TypeFieldDescriptionprivate StringMessage ID to use for generic, unclassified errors or exceptions.Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(ProfileRequestContext input) private StringgetClassifiedMessage(MessageSourceAccessor messageSource, String classifiedError) Get classified message.private StringgetExceptionMessage(MessageSourceAccessor messageSource, Exception e) Get generic error message or exception message.voidSets whether non-message-based error messages should be exposed or turned into a more generic value.Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, initApplicationContext, isContextRequired, obtainApplicationContext, requiredContextClass, setApplicationContext
-
Field Details
-
genericMessageID
Message ID to use for generic, unclassified errors or exceptions.
-
-
Constructor Details
-
PasswordErrorMessageLookupFunction
public PasswordErrorMessageLookupFunction()
-
-
Method Details
-
setGenericMessageID
Sets whether non-message-based error messages should be exposed or turned into a more generic value.- Parameters:
id- message ID
-
apply
- Specified by:
applyin interfaceFunction<ProfileRequestContext,String>
-
getClassifiedMessage
@Nullable private String getClassifiedMessage(@Nonnull MessageSourceAccessor messageSource, @Nonnull String classifiedError) Get classified message.- Parameters:
messageSource- Spring message sourceclassifiedError- 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 sourcee- exception- Returns:
- the exception message or the generic message as appropriate
-