diff options
-rw-r--r-- | src/saml2/client.py | 2 | ||||
-rw-r--r-- | src/saml2/client_base.py | 4 | ||||
-rw-r--r-- | src/saml2/entity.py | 8 | ||||
-rw-r--r-- | src/saml2/response.py | 1 |
4 files changed, 11 insertions, 4 deletions
diff --git a/src/saml2/client.py b/src/saml2/client.py index c23fc8c2..91f8f6c1 100644 --- a/src/saml2/client.py +++ b/src/saml2/client.py @@ -47,8 +47,6 @@ except ImportError: # Compatibility with Python <= 2.5 from cgi import parse_qs - - import logging logger = logging.getLogger(__name__) diff --git a/src/saml2/client_base.py b/src/saml2/client_base.py index 256d7e0e..e8d28571 100644 --- a/src/saml2/client_base.py +++ b/src/saml2/client_base.py @@ -526,7 +526,9 @@ class Base(Entity): logger.debug(">> %s", resp) - if isinstance(resp, AuthnResponse): + if resp is None: + return None + elif isinstance(resp, AuthnResponse): self.users.add_information_about_person(resp.session_info()) logger.info("--- ADDED person info ----") else: diff --git a/src/saml2/entity.py b/src/saml2/entity.py index 32b0a403..72fbcb83 100644 --- a/src/saml2/entity.py +++ b/src/saml2/entity.py @@ -17,6 +17,7 @@ from saml2 import request from saml2 import soap from saml2 import element_to_extension_element from saml2 import extension_elements_to_elements + from saml2.saml import NameID from saml2.saml import Issuer from saml2.saml import NAMEID_FORMAT_ENTITY @@ -791,7 +792,12 @@ class Entity(HTTPBase): logger.debug("XMLSTR: %s" % xmlstr) - response = response.loads(xmlstr, False) + try: + response = response.loads(xmlstr, False) + except Exception, err: + if "not well-formed" in "%s" % err: + logger.error("Not well-formed XML") + return None if response: response = response.verify() diff --git a/src/saml2/response.py b/src/saml2/response.py index 9d5acc46..87ea4c4e 100644 --- a/src/saml2/response.py +++ b/src/saml2/response.py @@ -311,6 +311,7 @@ class StatusResponse(object): raise except Exception, excp: logger.exception("EXCEPTION: %s", excp) + raise #print "<", self.response |