providers/saml: fix encoding for POST bindings

This commit is contained in:
Jens Langhammer
2020-07-12 17:55:09 +02:00
parent 996aa367d3
commit 1675dab314
6 changed files with 14 additions and 12 deletions

View File

@ -1,4 +1,5 @@
"""SAML AuthnRequest Processor"""
from base64 import b64encode
from typing import Dict
from urllib.parse import quote_plus
@ -10,7 +11,7 @@ from lxml.etree import Element # nosec
from signxml import XMLSigner
from passbook.providers.saml.utils import get_random_id
from passbook.providers.saml.utils.encoding import deflate_and_base64_encode, nice64
from passbook.providers.saml.utils.encoding import deflate_and_base64_encode
from passbook.providers.saml.utils.time import get_time_string
from passbook.sources.saml.models import SAMLSource
from passbook.sources.saml.processors.constants import (
@ -115,6 +116,6 @@ class RequestProcessor:
sig_hash,
)
response_dict["SigAlg"] = sig_alg
response_dict["Signature"] = nice64(signature)
response_dict["Signature"] = b64encode(signature).decode()
return response_dict

View File

@ -68,6 +68,7 @@ class ResponseProcessor:
verifier.verify(
self._root_xml, x509_cert=self._source.signing_kp.certificate_data
)
LOGGER.debug("Successfully verified signautre")
def _handle_name_id_transient(self, request: HttpRequest) -> HttpResponse:
"""Handle a NameID with the Format of Transient. This is a bit more complex than other