Skip to content

Commit 8365e91

Browse files
committed
Fix 60. lxml ValueError exception
1 parent e08cc28 commit 8365e91

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/onelogin/saml2/idp_metadata_parser.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import ssl
1818

19+
from onelogin.saml2 import compat
1920
from onelogin.saml2.constants import OneLogin_Saml2_Constants
2021
from onelogin.saml2.xml_utils import OneLogin_Saml2_XML
2122

@@ -51,7 +52,7 @@ def get_metadata(url, validate_cert=True):
5152

5253
if xml:
5354
try:
54-
dom = OneLogin_Saml2_XML.to_etree(xml)
55+
dom = OneLogin_Saml2_XML.to_etree(compat.to_bytes(xml))
5556
idp_descriptor_nodes = OneLogin_Saml2_XML.query(dom, '//md:IDPSSODescriptor')
5657
if idp_descriptor_nodes:
5758
valid = True
@@ -124,7 +125,7 @@ def parse(
124125
"""
125126
data = {}
126127

127-
dom = OneLogin_Saml2_XML.to_etree(idp_metadata)
128+
dom = OneLogin_Saml2_XML.to_etree(compat.to_bytes(idp_metadata))
128129
idp_entity_id = want_authn_requests_signed = idp_name_id_format = idp_sso_url = idp_slo_url = certs = None
129130

130131
entity_desc_path = '//md:EntityDescriptor'

src/onelogin/saml2/logout_response.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(self, settings, response=None):
3939

4040
if response is not None:
4141
self.__logout_response = compat.to_string(OneLogin_Saml2_Utils.decode_base64_and_inflate(response))
42-
self.document = OneLogin_Saml2_XML.to_etree(self.__logout_response)
42+
self.document = OneLogin_Saml2_XML.to_etree(compat.to_bytes(self.__logout_response))
4343
self.id = self.document.get('ID', None)
4444

4545
def get_issuer(self):
@@ -169,7 +169,7 @@ def build(self, in_response_to):
169169
'status': "urn:oasis:names:tc:SAML:2.0:status:Success"
170170
}
171171

172-
self.__logout_response = logout_response
172+
self.__logout_response = compat.to_string(logout_response)
173173

174174
def get_response(self, deflate=True):
175175
"""

0 commit comments

Comments
 (0)