Skip to content

Commit ab2c644

Browse files
Merge pull request #553 from johanlundberg/non_ascii_ava_encryption_decryption
AuthnResponse should store member xmlstr in correct type
2 parents 691e981 + 692bc8e commit ab2c644

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/saml2/response.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,10 @@ def load_instance(self, instance):
319319
def _loads(self, xmldata, decode=True, origxml=None):
320320

321321
# own copy
322-
self.xmlstr = xmldata[:]
322+
if isinstance(xmldata, six.binary_type):
323+
self.xmlstr = xmldata[:].decode('utf-8')
324+
else:
325+
self.xmlstr = xmldata[:]
323326
logger.debug("xmlstr: %s", self.xmlstr)
324327
if origxml:
325328
self.origxml = origxml
@@ -1082,15 +1085,13 @@ def session_info(self):
10821085
"session_index": authn_statement.session_index}
10831086

10841087
def __str__(self):
1085-
if isinstance(self.xmlstr, six.string_types):
1086-
return self.xmlstr
1087-
return str(self.xmlstr)
1088+
return self.xmlstr
10881089

10891090
def verify_recipient(self, recipient):
10901091
"""
10911092
Verify that I'm the recipient of the assertion
1092-
1093-
:param recipient: A URI specifying the entity or location to which an
1093+
1094+
:param recipient: A URI specifying the entity or location to which an
10941095
attesting entity can present the assertion.
10951096
:return: True/False
10961097
"""

tests/test_65_authn_query.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ def test_flow():
6565

6666
with closing(Server(config_file="idp_all_conf")) as idp:
6767
relay_state = "FOO"
68-
# -- dummy request ---
69-
orig_req = AuthnRequest(
70-
issuer=sp._issuer(),
71-
name_id_policy=NameIDPolicy(allow_create="true",
72-
format=NAMEID_FORMAT_TRANSIENT))
7368

7469
# == Create an AuthnRequest response
7570

0 commit comments

Comments
 (0)