Skip to content

Commit

Permalink
fix: authn request signature not fails anymore if relaystate is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
peppelinux committed Dec 14, 2022
1 parent 823d94e commit 1b5d195
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/spid_sp_test/__init__.py
Expand Up @@ -6,7 +6,7 @@


BASE_DIR = Path(__file__).resolve().parent
__version__ = "1.2.9"
__version__ = "1.2.10"
__name__ = "spid_sp_test"
logger = logging.getLogger(__name__)

Expand Down
16 changes: 11 additions & 5 deletions src/spid_sp_test/authn_request.py
Expand Up @@ -350,11 +350,17 @@ def test_xmldsig(self):
self.authn_request.get("RelayState") or ""
)
quoted_sigalg = urllib.parse.quote_plus(_sigalg)
authn_req = (
f"SAMLRequest={quoted_req}&"
f"RelayState={quoted_rs}&"
f"SigAlg={quoted_sigalg}"
)
if quoted_rs:
authn_req = (
f"SAMLRequest={quoted_req}&"
f"RelayState={quoted_rs}&"
f"SigAlg={quoted_sigalg}"
)
else:
authn_req = (
f"SAMLRequest={quoted_req}&"
f"SigAlg={quoted_sigalg}"
)

payload_file = NamedTemporaryFile(suffix=".xml")
payload_file.write(authn_req.encode())
Expand Down

0 comments on commit 1b5d195

Please sign in to comment.