providers/saml: fix AuthnRequestsSigned and WantAssertionsSigned not loaded correctly

This commit is contained in:
Jens Langhammer 2021-02-16 21:11:14 +01:00
parent baa2ed5ecc
commit 099197ba8c
4 changed files with 10 additions and 4 deletions

View File

@ -18,6 +18,8 @@ from authentik.lib.views import CreateAssignPermView
class DeleteMessageView(SuccessMessageMixin, DeleteView): class DeleteMessageView(SuccessMessageMixin, DeleteView):
"""DeleteView which shows `self.success_message` on successful deletion""" """DeleteView which shows `self.success_message` on successful deletion"""
success_url = "/"
def delete(self, request, *args, **kwargs): def delete(self, request, *args, **kwargs):
messages.success(self.request, self.success_message) messages.success(self.request, self.success_message)
return super().delete(request, *args, **kwargs) return super().delete(request, *args, **kwargs)

View File

@ -118,7 +118,9 @@ class PolicyBindingSerializer(ModelSerializer):
class PolicyBindingViewSet(ModelViewSet): class PolicyBindingViewSet(ModelViewSet):
"""PolicyBinding Viewset""" """PolicyBinding Viewset"""
queryset = PolicyBinding.objects.all().select_related("policy", "target", "group", "user") queryset = PolicyBinding.objects.all().select_related(
"policy", "target", "group", "user"
)
serializer_class = PolicyBindingSerializer serializer_class = PolicyBindingSerializer
filterset_fields = ["policy", "target", "enabled", "order", "timeout"] filterset_fields = ["policy", "target", "enabled", "order", "timeout"]
search_fields = ["policy__name"] search_fields = ["policy__name"]

View File

@ -134,8 +134,10 @@ class ServiceProviderMetadataParser:
# For now we'll only look at the first descriptor. # For now we'll only look at the first descriptor.
# Even if multiple descriptors exist, we can only configure one # Even if multiple descriptors exist, we can only configure one
descriptor = sp_sso_descriptors[0] descriptor = sp_sso_descriptors[0]
auth_n_request_signed = descriptor.attrib["AuthnRequestsSigned"] auth_n_request_signed = (
assertion_signed = descriptor.attrib["WantAssertionsSigned"] descriptor.attrib["AuthnRequestsSigned"].lower() == "true"
)
assertion_signed = descriptor.attrib["WantAssertionsSigned"].lower() == "true"
acs_services = descriptor.findall( acs_services = descriptor.findall(
f"{{{NS_SAML_METADATA}}}AssertionConsumerService" f"{{{NS_SAML_METADATA}}}AssertionConsumerService"

View File

@ -54,7 +54,7 @@ class MetadataImportView(LoginRequiredMixin, FormView):
form_class = SAMLProviderImportForm form_class = SAMLProviderImportForm
template_name = "providers/saml/import.html" template_name = "providers/saml/import.html"
success_url = "" success_url = "/"
def dispatch(self, request, *args, **kwargs): def dispatch(self, request, *args, **kwargs):
if not request.user.is_superuser: if not request.user.is_superuser: