authentik.sources.saml.exceptions

authentik saml source exceptions

 1"""authentik saml source exceptions"""
 2
 3from authentik.lib.tracing.exceptions import TracingIgnoredException
 4
 5
 6class SAMLException(TracingIgnoredException):
 7    """Base SAML Exception"""
 8
 9    default_message = "An unspecified SAML error occurred."
10
11    def __str__(self):
12        if self.args:
13            return super().__str__()
14        return self.default_message
15
16
17class InvalidEncryption(SAMLException):
18    """Encryption of XML Object is either missing or invalid."""
19
20    default_message = "The encryption of the SAML object is either missing or invalid."
21
22
23class InvalidSignature(SAMLException):
24    """Signature of XML Object is either missing or invalid."""
25
26    default_message = "The signature of the SAML object is either missing or invalid."
27
28
29class InvalidTime(SAMLException):
30    """Exception raised when the current time is outside the Assertion's validity window."""
31
32    default_message = "The SAML assertion is not valid yet or has expired."
33
34
35class MismatchedAudience(SAMLException):
36    """Exception raised when none of the assertion's audiences match the source's entity ID."""
37
38    default_message = "The SAML assertion audience does not match the entity ID of this source."
39
40
41class MismatchedRequestID(SAMLException):
42    """Exception raised when the returned request ID doesn't match the saved ID."""
43
44    default_message = "The SAML Response ID does not match the original request ID."
45
46
47class MismatchedBinding(SAMLException):
48    """Exception raised when the Response is not addressed to this Source."""
49
50    default_message = "The SAML Response is not addressed to this Source."
51
52
53class MissingNameID(SAMLException):
54    """Exception raised when the assertion has no Subject NameID to identify the user by."""
55
56    default_message = "The SAML assertion does not contain a NameID."
57
58
59class MissingSAMLResponse(SAMLException):
60    """Exception raised when request does not contain SAML Response."""
61
62    default_message = "Request does not contain a SAML response."
63
64
65class UnsuccessfulStatus(SAMLException):
66    """Exception raised when the SAML Response carries a non-success Status."""
67
68    default_message = "The identity provider did not complete the authentication request."
69
70
71class UnsupportedNameIDFormat(SAMLException):
72    """Exception raised when SAML Response contains NameID Format not supported."""
73
74    default_message = "The NameID Format in the SAML Response is not supported."
 7class SAMLException(TracingIgnoredException):
 8    """Base SAML Exception"""
 9
10    default_message = "An unspecified SAML error occurred."
11
12    def __str__(self):
13        if self.args:
14            return super().__str__()
15        return self.default_message

Base SAML Exception

default_message = 'An unspecified SAML error occurred.'
class InvalidEncryption(SAMLException):
18class InvalidEncryption(SAMLException):
19    """Encryption of XML Object is either missing or invalid."""
20
21    default_message = "The encryption of the SAML object is either missing or invalid."

Encryption of XML Object is either missing or invalid.

default_message = 'The encryption of the SAML object is either missing or invalid.'
class InvalidSignature(SAMLException):
24class InvalidSignature(SAMLException):
25    """Signature of XML Object is either missing or invalid."""
26
27    default_message = "The signature of the SAML object is either missing or invalid."

Signature of XML Object is either missing or invalid.

default_message = 'The signature of the SAML object is either missing or invalid.'
class InvalidTime(SAMLException):
30class InvalidTime(SAMLException):
31    """Exception raised when the current time is outside the Assertion's validity window."""
32
33    default_message = "The SAML assertion is not valid yet or has expired."

Exception raised when the current time is outside the Assertion's validity window.

default_message = 'The SAML assertion is not valid yet or has expired.'
class MismatchedAudience(SAMLException):
36class MismatchedAudience(SAMLException):
37    """Exception raised when none of the assertion's audiences match the source's entity ID."""
38
39    default_message = "The SAML assertion audience does not match the entity ID of this source."

Exception raised when none of the assertion's audiences match the source's entity ID.

default_message = 'The SAML assertion audience does not match the entity ID of this source.'
class MismatchedRequestID(SAMLException):
42class MismatchedRequestID(SAMLException):
43    """Exception raised when the returned request ID doesn't match the saved ID."""
44
45    default_message = "The SAML Response ID does not match the original request ID."

Exception raised when the returned request ID doesn't match the saved ID.

default_message = 'The SAML Response ID does not match the original request ID.'
class MismatchedBinding(SAMLException):
48class MismatchedBinding(SAMLException):
49    """Exception raised when the Response is not addressed to this Source."""
50
51    default_message = "The SAML Response is not addressed to this Source."

Exception raised when the Response is not addressed to this Source.

default_message = 'The SAML Response is not addressed to this Source.'
class MissingNameID(SAMLException):
54class MissingNameID(SAMLException):
55    """Exception raised when the assertion has no Subject NameID to identify the user by."""
56
57    default_message = "The SAML assertion does not contain a NameID."

Exception raised when the assertion has no Subject NameID to identify the user by.

default_message = 'The SAML assertion does not contain a NameID.'
class MissingSAMLResponse(SAMLException):
60class MissingSAMLResponse(SAMLException):
61    """Exception raised when request does not contain SAML Response."""
62
63    default_message = "Request does not contain a SAML response."

Exception raised when request does not contain SAML Response.

default_message = 'Request does not contain a SAML response.'
class UnsuccessfulStatus(SAMLException):
66class UnsuccessfulStatus(SAMLException):
67    """Exception raised when the SAML Response carries a non-success Status."""
68
69    default_message = "The identity provider did not complete the authentication request."

Exception raised when the SAML Response carries a non-success Status.

default_message = 'The identity provider did not complete the authentication request.'
class UnsupportedNameIDFormat(SAMLException):
72class UnsupportedNameIDFormat(SAMLException):
73    """Exception raised when SAML Response contains NameID Format not supported."""
74
75    default_message = "The NameID Format in the SAML Response is not supported."

Exception raised when SAML Response contains NameID Format not supported.

default_message = 'The NameID Format in the SAML Response is not supported.'