*/saml: start implementing unittests, fix signing

This commit is contained in:
Jens Langhammer
2020-07-11 19:57:27 +02:00
parent 2056b86ce7
commit a393097504
4 changed files with 64 additions and 16 deletions

View File

@ -1,7 +1,6 @@
"""SAML Assertion generator"""
from types import GeneratorType
from defusedxml import ElementTree
from django.http import HttpRequest
from lxml import etree # nosec
from lxml.etree import Element, SubElement # nosec
@ -212,4 +211,4 @@ class AssertionProcessor:
signed, x509_cert=self.provider.signing_kp.certificate_data
)
return etree.tostring(signed).decode("utf-8") # nosec
return ElementTree.tostring(root_response).decode()
return etree.tostring(root_response).decode("utf-8") # nosec

View File

@ -1,6 +1,6 @@
"""SAML AuthNRequest Parser and dataclass"""
from typing import Optional
from dataclasses import dataclass
from typing import Optional
from cryptography.exceptions import InvalidSignature
from defusedxml import ElementTree
@ -9,7 +9,6 @@ from structlog import get_logger
from passbook.providers.saml.exceptions import CannotHandleAssertion
from passbook.providers.saml.models import SAMLProvider
from passbook.providers.saml.utils import get_random_id
from passbook.providers.saml.utils.encoding import decode_base64_and_inflate
LOGGER = get_logger()