providers/saml: improve error handling for signature errors
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
2580371f94
commit
5b837c3ccc
|
@ -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:
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
Reference in New Issue