summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kanakarakis <ivan.kanak@gmail.com>2023-01-31 13:20:24 +0200
committerGitHub <noreply@github.com>2023-01-31 13:20:24 +0200
commit01f5567facf5f5ef61d4f9e10ed6424b6ed2dae3 (patch)
treeaaf6bf59518ed2b973a395845eea2fff2c29089d
parent63b228837a27eda562c4335148c06c3ad0a89981 (diff)
parenteb01d81cdfc559737c15b112bbde9abe452e4bad (diff)
downloadpysaml2-01f5567facf5f5ef61d4f9e10ed6424b6ed2dae3.tar.gz
Merge pull request #895 from earonesty/earonesty-patch-1
Fix compatibility issues processing the payload with some saml implementations
-rw-r--r--src/saml2/entity.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/saml2/entity.py b/src/saml2/entity.py
index 9d0d2dcf..8016b481 100644
--- a/src/saml2/entity.py
+++ b/src/saml2/entity.py
@@ -3,6 +3,7 @@ from binascii import hexlify
import copy
from hashlib import sha1
import logging
+import zlib
import requests
@@ -444,7 +445,10 @@ class Entity(HTTPBase):
if binding == BINDING_HTTP_REDIRECT:
xmlstr = decode_base64_and_inflate(txt)
elif binding == BINDING_HTTP_POST:
- xmlstr = base64.b64decode(txt)
+ try:
+ xmlstr = decode_base64_and_inflate(txt)
+ except zlib.error:
+ xmlstr = base64.b64decode(txt)
elif binding == BINDING_SOAP:
func = getattr(soap, f"parse_soap_enveloped_saml_{msgtype}")
xmlstr = func(txt)