Skip to content
This repository was archived by the owner on Sep 29, 2023. It is now read-only.

Commit 3475b9c

Browse files
authored
Merge pull request #251 from AzureAD/saml-utf8
Use utf-8 instead of us-ascii for saml token
2 parents f1bc11d + b5767c0 commit 3475b9c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

adal/wstrust_response.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,9 @@ def _parse_token_by_re(raw_response):
214214
token_types = findall_content(rstr, "TokenType")
215215
tokens = findall_content(rstr, "RequestedSecurityToken")
216216
if token_types and tokens:
217-
return tokens[0].encode('us-ascii'), token_types[0]
217+
# Historically, we use "us-ascii" encoding, but it should be "utf-8"
218+
# https://stackoverflow.com/questions/36658000/what-is-encoding-used-for-saml-conversations
219+
return tokens[0].encode('utf-8'), token_types[0]
218220

219221

220222
def parse(self):

0 commit comments

Comments
 (0)