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/ecp_client.py | |
parent | 7b1b52e03f06310bc23f688fe3f373881950a9f7 (diff) | |
download | pysaml2-bc96c3856dfd6ffbd27e0f59acacfef2b71e4edd.tar.gz |
Replace assert with proper checksassert_deletion
Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
Diffstat (limited to 'src/saml2/ecp_client.py')
-rw-r--r-- | src/saml2/ecp_client.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/saml2/ecp_client.py b/src/saml2/ecp_client.py index f0183f45..5265f99d 100644 --- a/src/saml2/ecp_client.py +++ b/src/saml2/ecp_client.py @@ -136,7 +136,14 @@ class Client(Entity): logger.debug("[P2] IdP response dict: %s", respdict) idp_response = respdict["body"] - assert idp_response.c_tag == "Response" + + expected_tag = "Response" + if idp_response.c_tag != expected_tag: + raise ValueError( + "Invalid Response tag '{invalid}' should be '{valid}'".format( + invalid=idp_response.c_tag, valid=expected_tag + ) + ) logger.debug("[P2] IdP AUTHN response: %s", idp_response) @@ -165,7 +172,14 @@ class Client(Entity): # AuthnRequest in the body or not authn_request = respdict["body"] - assert authn_request.c_tag == "AuthnRequest" + + expected_tag = "AuthnRequest" + if authn_request.c_tag != expected_tag: + raise ValueError( + "Invalid AuthnRequest tag '{invalid}' should be '{valid}'".format( + invalid=authn_request.c_tag, valid=expected_tag + ) + ) # ecp.RelayState among headers _relay_state = None |