diff options
author | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2020-09-10 02:28:38 +0300 |
---|---|---|
committer | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2020-09-11 02:11:12 +0300 |
commit | bc96c3856dfd6ffbd27e0f59acacfef2b71e4edd (patch) | |
tree | 543f78595d25fd3127199e26917df9b3c67c156b /src/saml2/entity.py | |
parent | 7b1b52e03f06310bc23f688fe3f373881950a9f7 (diff) | |
download | pysaml2-assert_deletion.tar.gz |
Replace assert with proper checksassert_deletion
Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
Diffstat (limited to 'src/saml2/entity.py')
-rw-r--r-- | src/saml2/entity.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/saml2/entity.py b/src/saml2/entity.py index 91219d72..9f564ffa 100644 --- a/src/saml2/entity.py +++ b/src/saml2/entity.py @@ -848,7 +848,7 @@ class Entity(HTTPBase): _log_debug("Loaded request") if _request: - _request = _request.verify() + _request.verify() _log_debug("Verified request") if not _request: @@ -1192,14 +1192,14 @@ class Entity(HTTPBase): response.require_signature = True # Verify that the assertion is syntactically correct and the # signature on the assertion is correct if present. - response = response.verify(keys) + response.verify(keys) except SignatureError as err: if require_signature: logger.error("Signature Error: %s", err) raise else: response.require_signature = require_signature - response = response.verify(keys) + response.verify(keys) else: assertions_are_signed = True finally: @@ -1260,7 +1260,13 @@ class Entity(HTTPBase): _art = base64.b64decode(artifact) - assert _art[:2] == ARTIFACT_TYPECODE + typecode = _art[:2] + if typecode != ARTIFACT_TYPECODE: + raise ValueError( + "Invalid artifact typecode '{invalid}' should be {valid}".format( + invalid=typecode, valid=ARTIFACT_TYPECODE + ) + ) try: endpoint_index = str(int(_art[2:4])) |