Exceptions¶
All errors raised by pygamlastan derive from a single base class, so you can
catch one base type or a specific subtype. Operations raise these on failure;
note that security validation via
pygamlastan.security.validate_response() instead returns a structured
ValidationResult (it does not raise), while
pygamlastan.profiles.process_response() raises
SamlProfileError on the first failure.
- exception pygamlastan.SamlError¶
Base class for every pygamlastan error.
- exception pygamlastan.SamlCoreError¶
Invalid core SAML value (e.g. a malformed entity id).
- exception pygamlastan.SamlXmlError¶
XML parsing or serialization failure.
- exception pygamlastan.SamlCryptoError¶
Signing, verification, encryption, decryption, or canonicalization failure.
- exception pygamlastan.SamlBindingError¶
Protocol-binding encode/decode failure (bad base64, oversized RelayState, invalid artifact, …).
- exception pygamlastan.SamlMetadataError¶
Metadata validation failure.
- exception pygamlastan.SamlSecurityError¶
Security validation error surfaced as an exception.
- exception pygamlastan.SamlProfileError¶
A profile operation failed, including assertion/response validation in
pygamlastan.profiles.process_response().
- exception pygamlastan.SamlPolicyError¶
Attribute-release policy error.
- exception pygamlastan.SamlIdentError¶
Identity-store error.
Example¶
import pygamlastan
from pygamlastan import xml
try:
response = xml.parse_response(untrusted_xml)
except pygamlastan.SamlXmlError as exc:
... # malformed XML
except pygamlastan.SamlError as exc:
... # any other pygamlastan error