public class AuthenticationExceptionHandler
extends java.lang.Object
AuthenticationException raised from the authentication
layer:
errors
in list order. The first entry that matches determines the outcome state, which
is the simple class name of the exception.| Constructor and Description |
|---|
AuthenticationExceptionHandler() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsCustomErrors()
Package-private helper method to aid in testing.
|
java.util.Set<java.lang.Class<? extends java.lang.Exception>> |
getErrors() |
java.lang.String |
handle(java.lang.Exception e,
org.springframework.binding.message.MessageContext messageContext)
Maps an authentication exception onto a state name.
|
protected java.lang.String |
handleAbstractTicketException(org.apereo.cas.ticket.AbstractTicketException e,
org.springframework.binding.message.MessageContext messageContext)
Maps an
AbstractTicketException onto a state name equal to the simple class name of the exception with
highest precedence. |
protected java.lang.String |
handleAuthenticationException(org.apereo.cas.authentication.AuthenticationException e,
org.springframework.binding.message.MessageContext messageContext)
Maps an authentication exception onto a state name equal to the simple class name of the
AuthenticationException.getHandlerErrors()
with highest precedence. |
void |
setErrors(java.util.List<java.lang.Class<? extends java.lang.Exception>> errors)
Sets the list of custom exceptions that this class knows how to handle.
|
void |
setMessageBundlePrefix(java.lang.String prefix)
Sets the message bundle prefix appended to exception class names to create a message bundle key for that
particular error.
|
public void setErrors(java.util.List<java.lang.Class<? extends java.lang.Exception>> errors)
This implementation adds the provided list of exceptions to the default list or just returns if the provided list is empty.
This implementation relies on Spring's property source configurer, SpEL, and conversion service infrastructure facilities to convert and inject the collection from cas properties.
This method is thread-safe. It should only be called by the Spring container during application context bootstrap or unit tests.
errors - List of errors in order of descending precedence.public java.util.Set<java.lang.Class<? extends java.lang.Exception>> getErrors()
public final boolean containsCustomErrors()
public void setMessageBundlePrefix(java.lang.String prefix)
prefix - Prefix appended to exception names.public java.lang.String handle(java.lang.Exception e,
org.springframework.binding.message.MessageContext messageContext)
e - Authentication error to handle.messageContext - the spring message contextprotected java.lang.String handleAuthenticationException(org.apereo.cas.authentication.AuthenticationException e,
org.springframework.binding.message.MessageContext messageContext)
AuthenticationException.getHandlerErrors()
with highest precedence. Also sets an ERROR severity message in the
message context of the form [messageBundlePrefix][exceptionClassSimpleName]
for for the first handler
error that is configured. If no match is found, is returned.e - Authentication error to handle.messageContext - the spring message contextprotected java.lang.String handleAbstractTicketException(org.apereo.cas.ticket.AbstractTicketException e,
org.springframework.binding.message.MessageContext messageContext)
AbstractTicketException onto a state name equal to the simple class name of the exception with
highest precedence. Also sets an ERROR severity message in the message context with the error code found in
RootCasException.getCode(). If no match is found,
is returned.e - Ticket exception to handle.messageContext - the spring message context