Skip to content

Commit d0c319d

Browse files
committed
Don't require compression on LogoutResponse messages by relaxing the decode_base64_and_inflate method
1 parent c7e5cda commit d0c319d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/onelogin/saml2/utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,14 @@ def decode_base64_and_inflate(value):
9898
:returns: the string after decoding and inflating
9999
:rtype: string
100100
"""
101+
decoded = base64.b64decode(value)
102+
# We try to inflate
103+
try:
104+
result = zlib.decompress(decoded, -15)
105+
except Exception:
106+
result = decoded
101107

102-
return zlib.decompress(base64.b64decode(value), -15).decode('utf-8')
108+
return result.decode('utf-8')
103109

104110
@staticmethod
105111
def deflate_and_base64_encode(value):

0 commit comments

Comments
 (0)