diff options
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])) |