From a0a2e95a2ae3a9805a06b19f034f51612b1066c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20Ho=CC=88rberg?= Date: Wed, 19 Mar 2014 16:14:48 +0100 Subject: [PATCH] Fix for EncryptedAssertion --- src/saml2/entity.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/saml2/entity.py b/src/saml2/entity.py index e9e07a1..3a633b3 100644 --- a/src/saml2/entity.py +++ b/src/saml2/entity.py @@ -839,12 +839,13 @@ class Entity(HTTPBase): logger.debug("XMLSTR: %s" % xmlstr) - for encrypted_assertion in response.response.encrypted_assertion: - if encrypted_assertion.extension_elements is not None: - assertion_list = extension_elements_to_elements(encrypted_assertion.extension_elements, [saml]) - for assertion in assertion_list: - _assertion = saml.assertion_from_string(str(assertion)) - response.response.assertion.append(_assertion) + if hasattr(response.response, 'encrypted_assertion'): + for encrypted_assertion in response.response.encrypted_assertion: + if encrypted_assertion.extension_elements is not None: + assertion_list = extension_elements_to_elements(encrypted_assertion.extension_elements, [saml]) + for assertion in assertion_list: + _assertion = saml.assertion_from_string(str(assertion)) + response.response.assertion.append(_assertion) if response: response = response.verify()