From 2b78c4ba86499a4d31359934cfda6c1e75422cb8 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 5 Dec 2021 10:51:56 +0100 Subject: [PATCH] *: use request.query_params instead of accessing the django request Signed-off-by: Jens Langhammer --- authentik/crypto/api.py | 4 ++-- authentik/providers/saml/api.py | 2 +- authentik/providers/saml/processors/assertion.py | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/authentik/crypto/api.py b/authentik/crypto/api.py index fc62285fa..08bbf86f8 100644 --- a/authentik/crypto/api.py +++ b/authentik/crypto/api.py @@ -192,7 +192,7 @@ class CertificateKeyPairViewSet(UsedByMixin, ModelViewSet): secret=certificate, type="certificate", ).from_http(request) - if "download" in request._request.GET: + if "download" in request.query_params: # Mime type from https://pki-tutorial.readthedocs.io/en/latest/mime.html response = HttpResponse( certificate.certificate_data, content_type="application/x-pem-file" @@ -223,7 +223,7 @@ class CertificateKeyPairViewSet(UsedByMixin, ModelViewSet): secret=certificate, type="private_key", ).from_http(request) - if "download" in request._request.GET: + if "download" in request.query_params: # Mime type from https://pki-tutorial.readthedocs.io/en/latest/mime.html response = HttpResponse(certificate.key_data, content_type="application/x-pem-file") response[ diff --git a/authentik/providers/saml/api.py b/authentik/providers/saml/api.py index 8c3bc7257..deda0400c 100644 --- a/authentik/providers/saml/api.py +++ b/authentik/providers/saml/api.py @@ -123,7 +123,7 @@ class SAMLProviderViewSet(UsedByMixin, ModelViewSet): raise Http404 try: metadata = MetadataProcessor(provider, request).build_entity_descriptor() - if "download" in request._request.GET: + if "download" in request.query_params: response = HttpResponse(metadata, content_type="application/xml") response[ "Content-Disposition" diff --git a/authentik/providers/saml/processors/assertion.py b/authentik/providers/saml/processors/assertion.py index 01e0b9b5f..fff3b7b67 100644 --- a/authentik/providers/saml/processors/assertion.py +++ b/authentik/providers/saml/processors/assertion.py @@ -10,7 +10,6 @@ from structlog.stdlib import get_logger from authentik.core.exceptions import PropertyMappingExpressionException from authentik.events.models import Event, EventAction -from authentik.lib.utils.errors import exception_to_string from authentik.lib.utils.time import timedelta_from_string from authentik.providers.saml.models import SAMLPropertyMapping, SAMLProvider from authentik.providers.saml.processors.request_parser import AuthNRequest @@ -106,7 +105,7 @@ class AssertionProcessor: # Value error can be raised when assigning invalid data to an attribute Event.new( EventAction.CONFIGURATION_ERROR, - message=f"Failed to evaluate property-mapping: {exception_to_string(exc)}", + message=f"Failed to evaluate property-mapping: {str(exc)}", mapping=mapping, ).from_http(self.http_request) continue