diff --git a/authentik/providers/saml/api.py b/authentik/providers/saml/api.py index a5cdcf6c7..ba2ff33e6 100644 --- a/authentik/providers/saml/api.py +++ b/authentik/providers/saml/api.py @@ -3,7 +3,6 @@ from xml.etree.ElementTree import ParseError # nosec from defusedxml.ElementTree import fromstring from django.http.response import HttpResponse -from django.shortcuts import get_object_or_404 from django.urls import reverse from django.utils.translation import gettext_lazy as _ from drf_spectacular.types import OpenApiTypes @@ -115,8 +114,7 @@ class SAMLProviderViewSet(UsedByMixin, ModelViewSet): # pylint: disable=invalid-name, unused-argument def metadata(self, request: Request, pk: int) -> Response: """Return metadata as XML string""" - # We don't use self.get_object() on purpose as this view is un-authenticated - provider = get_object_or_404(SAMLProvider, pk=pk) + provider = self.get_object() try: metadata = MetadataProcessor(provider, request).build_entity_descriptor() if "download" in request._request.GET: