summaryrefslogtreecommitdiff
path: root/src/saml2/ecp_client.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/saml2/ecp_client.py')
-rw-r--r--src/saml2/ecp_client.py18
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