Skip to content

Commit 01f5567

Browse files
Merge pull request #895 from earonesty/earonesty-patch-1
Fix compatibility issues processing the payload with some saml implementations
2 parents 63b2288 + eb01d81 commit 01f5567

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/saml2/entity.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import copy
44
from hashlib import sha1
55
import logging
6+
import zlib
67

78
import requests
89

@@ -444,7 +445,10 @@ def unravel(txt, binding, msgtype="response"):
444445
if binding == BINDING_HTTP_REDIRECT:
445446
xmlstr = decode_base64_and_inflate(txt)
446447
elif binding == BINDING_HTTP_POST:
447-
xmlstr = base64.b64decode(txt)
448+
try:
449+
xmlstr = decode_base64_and_inflate(txt)
450+
except zlib.error:
451+
xmlstr = base64.b64decode(txt)
448452
elif binding == BINDING_SOAP:
449453
func = getattr(soap, f"parse_soap_enveloped_saml_{msgtype}")
450454
xmlstr = func(txt)

0 commit comments

Comments
 (0)