Class Saml2ErrorStatusException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.springframework.security.core.AuthenticationException
se.swedenconnect.spring.saml.idp.error.Saml2ErrorStatusException
- All Implemented Interfaces:
Serializable
public class Saml2ErrorStatusException
extends org.springframework.security.core.AuthenticationException
Exception class that when thrown will lead to a SAML error status message being sent.
A message source code, and optionally parameters, may be supplied. This message code is resolved into a text that is
used as the Status status message.
- Author:
- Martin Lindström
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSaml2ErrorStatusException(String statusCode, String subStatusCode, String statusMessageCode, String defaultStatusMessage) Constructor.Saml2ErrorStatusException(String statusCode, String subStatusCode, String statusMessageCode, String defaultStatusMessage, String msg) Constructor.Saml2ErrorStatusException(String statusCode, String subStatusCode, String statusMessageCode, String defaultStatusMessage, String msg, Throwable cause) Constructor.Saml2ErrorStatusException(String statusCode, String subStatusCode, String statusMessageCode, String defaultStatusMessage, Throwable cause) Constructor.Constructor.Saml2ErrorStatusException(Saml2ErrorStatus status, String msg) Constructor.Saml2ErrorStatusException(Saml2ErrorStatus status, String msg, Throwable cause) Constructor.Saml2ErrorStatusException(Saml2ErrorStatus status, Throwable cause) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionGets a SAML v2Statuselement given this exception.getStatus(MessageSource messageSource, Locale locale) Gets a SAML v2Statuselement given this exception.voidsetCustomStatusMessage(String statusMessage) Assigns a custom status message.voidsetCustomStatusMessage(String statusMessageCode, String defaultStatusMessage) Assigns a custom status message.toString()Methods inherited from class org.springframework.security.core.AuthenticationException
getAuthenticationRequest, setAuthenticationRequestMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Constructor Details
-
Saml2ErrorStatusException
Constructor.- Parameters:
status- theSaml2ErrorStatus
-
Saml2ErrorStatusException
Constructor.- Parameters:
status- theSaml2ErrorStatusmsg- the error message (will not be included in the resultingStatusmessage)
-
Saml2ErrorStatusException
Constructor.- Parameters:
status- theSaml2ErrorStatuscause- the cause of the error
-
Saml2ErrorStatusException
Constructor.- Parameters:
status- theSaml2ErrorStatusmsg- the error message (will not be included in the resultingStatusmessage)cause- the cause of the error
-
Saml2ErrorStatusException
public Saml2ErrorStatusException(String statusCode, String subStatusCode, String statusMessageCode, String defaultStatusMessage) Constructor.- Parameters:
statusCode- the main status codesubStatusCode- the subordinate status codestatusMessageCode- the status message code (will be resolved against aMessageSource)defaultStatusMessage- the status message to use if thestatusMessageCodecan not be resolved against aMessageSource
-
Saml2ErrorStatusException
public Saml2ErrorStatusException(String statusCode, String subStatusCode, String statusMessageCode, String defaultStatusMessage, String msg) Constructor.- Parameters:
statusCode- the main status codesubStatusCode- the subordinate status codestatusMessageCode- the status message code (will be resolved against aMessageSourcedefaultStatusMessage- the status message to use if thestatusMessageCodecan not be resolved against aMessageSourcemsg- the error message (will not be included in the resultingStatusmessage)
-
Saml2ErrorStatusException
public Saml2ErrorStatusException(String statusCode, String subStatusCode, String statusMessageCode, String defaultStatusMessage, Throwable cause) Constructor.- Parameters:
statusCode- the main status codesubStatusCode- the subordinate status codestatusMessageCode- the status message code (will be resolved against aMessageSourcedefaultStatusMessage- the status message to use if thestatusMessageCodecan not be resolved against aMessageSourcecause- the cause of the error
-
Saml2ErrorStatusException
public Saml2ErrorStatusException(String statusCode, String subStatusCode, String statusMessageCode, String defaultStatusMessage, String msg, Throwable cause) Constructor.- Parameters:
statusCode- the main status codesubStatusCode- the subordinate status codestatusMessageCode- the status message code (will be resolved against aMessageSourcedefaultStatusMessage- the status message to use if thestatusMessageCodecan not be resolved against aMessageSourcemsg- the error message (will not be included in the resultingStatusmessage)cause- the cause of the error
-
-
Method Details
-
setCustomStatusMessage
Assigns a custom status message. May be used if the exception object is initialized using aSaml2ErrorStatusobject.- Parameters:
statusMessageCode- the status message code (for resolving against aMessageSourcedefaultStatusMessage- the default status message (if resolving fails)
-
setCustomStatusMessage
Assigns a custom status message. If aMessageSourceis being used when obtaining theStatususesetCustomStatusMessage(String, String)instead.- Parameters:
statusMessage- the status message
-
getStatus
Gets a SAML v2Statuselement given this exception.- Returns:
- a Status element
-
getStatus
Gets a SAML v2Statuselement given this exception.- Parameters:
messageSource- the message source to use when resolving the status message (if null, thedefaultStatusMessagewill be used)locale- the locale to use when resolving the status message- Returns:
- a Status element
-
toString
-