Skip to content

Commit

Permalink
Merge pull request #895 from earonesty/earonesty-patch-1
Browse files Browse the repository at this point in the history
Fix compatibility issues processing the payload with some saml implementations
  • Loading branch information
c00kiemon5ter committed Jan 31, 2023
2 parents 63b2288 + eb01d81 commit 01f5567
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/saml2/entity.py
Expand Up @@ -3,6 +3,7 @@
import copy
from hashlib import sha1
import logging
import zlib

import requests

Expand Down Expand Up @@ -444,7 +445,10 @@ def unravel(txt, binding, msgtype="response"):
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)
Expand Down

0 comments on commit 01f5567

Please sign in to comment.