providers/saml: improve error handling for signature errors

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-06-14 12:51:42 +02:00
parent 2580371f94
commit 5b837c3ccc
2 changed files with 3 additions and 3 deletions

View File

@ -120,7 +120,7 @@ class ServiceProviderMetadataParser:
) )
ctx.key = key ctx.key = key
ctx.verify(signature_node) ctx.verify(signature_node)
except xmlsec.VerificationError as exc: except xmlsec.Error as exc:
raise ValueError("Failed to verify Metadata signature") from exc raise ValueError("Failed to verify Metadata signature") from exc
def parse(self, raw_xml: str) -> ServiceProviderMetadata: def parse(self, raw_xml: str) -> ServiceProviderMetadata:

View File

@ -108,7 +108,7 @@ class AuthNRequestParser:
) )
ctx.key = key ctx.key = key
ctx.verify(signature_node) ctx.verify(signature_node)
except xmlsec.VerificationError as exc: except xmlsec.Error as exc:
raise CannotHandleAssertion(ERROR_FAILED_TO_VERIFY) from exc raise CannotHandleAssertion(ERROR_FAILED_TO_VERIFY) from exc
return self._parse_xml(decoded_xml, relay_state) return self._parse_xml(decoded_xml, relay_state)
@ -160,7 +160,7 @@ class AuthNRequestParser:
sign_algorithm_transform, sign_algorithm_transform,
b64decode(signature), b64decode(signature),
) )
except xmlsec.VerificationError as exc: except xmlsec.Error as exc:
raise CannotHandleAssertion(ERROR_FAILED_TO_VERIFY) from exc raise CannotHandleAssertion(ERROR_FAILED_TO_VERIFY) from exc
return self._parse_xml(decoded_xml, relay_state) return self._parse_xml(decoded_xml, relay_state)