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
ConstructorDescriptionSaml2ErrorStatusException
(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 TypeMethodDescriptionorg.opensaml.saml.saml2.core.Status
Gets a SAML v2Status
element given this exception.org.opensaml.saml.saml2.core.Status
getStatus
(MessageSource messageSource, Locale locale) Gets a SAML v2Status
element given this exception.void
setCustomStatusMessage
(String statusMessage) Assigns a custom status message.void
setCustomStatusMessage
(String statusMessageCode, String defaultStatusMessage) Assigns a custom status message.toString()
Methods 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
- theSaml2ErrorStatus
msg
- the error message (will not be included in the resultingStatus
message)
-
Saml2ErrorStatusException
Constructor.- Parameters:
status
- theSaml2ErrorStatus
cause
- the cause of the error
-
Saml2ErrorStatusException
Constructor.- Parameters:
status
- theSaml2ErrorStatus
msg
- the error message (will not be included in the resultingStatus
message)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 thestatusMessageCode
can 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 aMessageSource
defaultStatusMessage
- the status message to use if thestatusMessageCode
can not be resolved against aMessageSource
msg
- the error message (will not be included in the resultingStatus
message)
-
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 aMessageSource
defaultStatusMessage
- the status message to use if thestatusMessageCode
can not be resolved against aMessageSource
cause
- 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 aMessageSource
defaultStatusMessage
- the status message to use if thestatusMessageCode
can not be resolved against aMessageSource
msg
- the error message (will not be included in the resultingStatus
message)cause
- the cause of the error
-
-
Method Details
-
setCustomStatusMessage
Assigns a custom status message. May be used if the exception object is initialized using aSaml2ErrorStatus
object.- Parameters:
statusMessageCode
- the status message code (for resolving against aMessageSource
defaultStatusMessage
- the default status message (if resolving fails)
-
setCustomStatusMessage
Assigns a custom status message. If aMessageSource
is being used when obtaining theStatus
usesetCustomStatusMessage(String, String)
instead.- Parameters:
statusMessage
- the status message
-
getStatus
public org.opensaml.saml.saml2.core.Status getStatus()Gets a SAML v2Status
element given this exception.- Returns:
- a Status element
-
getStatus
Gets a SAML v2Status
element given this exception.- Parameters:
messageSource
- the message source to use when resolving the status message (if null, thedefaultStatusMessage
will be used)locale
- the locale to use when resolving the status message- Returns:
- a Status element
-
toString
-