providers/saml: handle uncompressed SAML AuthNRequest

This commit is contained in:
Jens Langhammer 2020-02-16 14:08:35 +01:00
parent e138076e1d
commit 447e81d0b8
2 changed files with 7 additions and 3 deletions

View File

@ -159,8 +159,9 @@ class Processor:
request_acs_url = self._request_params["ACS_URL"] request_acs_url = self._request_params["ACS_URL"]
if self._remote.acs_url != request_acs_url: if self._remote.acs_url != request_acs_url:
msg = "couldn't find ACS url '{}' in SAML2IDP_REMOTES " "setting.".format( msg = (
request_acs_url f"ACS URL of {request_acs_url} doesn't match Provider "
f"ACS URL of {self._remote.acs_url}."
) )
self._logger.info(msg) self._logger.info(msg)
raise CannotHandleAssertion(msg) raise CannotHandleAssertion(msg)

View File

@ -6,7 +6,10 @@ import zlib
def decode_base64_and_inflate(b64string): def decode_base64_and_inflate(b64string):
"""Base64 decode and ZLib decompress b64string""" """Base64 decode and ZLib decompress b64string"""
decoded_data = base64.b64decode(b64string) decoded_data = base64.b64decode(b64string)
return zlib.decompress(decoded_data, -15) try:
return zlib.decompress(decoded_data, -15)
except zlib.error:
return decoded_data
def deflate_and_base64_encode(string_val): def deflate_and_base64_encode(string_val):