From d0ee7908ab625d855829f22dd6e733d8ab550648 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 30 Dec 2020 22:02:41 +0100 Subject: [PATCH] providers/saml: force user to select authz flow for import --- authentik/providers/saml/forms.py | 3 +++ authentik/providers/saml/views.py | 1 + 2 files changed, 4 insertions(+) diff --git a/authentik/providers/saml/forms.py b/authentik/providers/saml/forms.py index 437d0898b..a5373ce46 100644 --- a/authentik/providers/saml/forms.py +++ b/authentik/providers/saml/forms.py @@ -94,6 +94,9 @@ class SAMLProviderImportForm(forms.Form): """Create a SAML Provider from SP Metadata.""" provider_name = forms.CharField() + authorization_flow = forms.ModelChoiceField( + queryset=Flow.objects.filter(designation=FlowDesignation.AUTHORIZATION) + ) metadata = forms.FileField( validators=[FileExtensionValidator(allowed_extensions=["xml"])] ) diff --git a/authentik/providers/saml/views.py b/authentik/providers/saml/views.py index 6cd7884bc..82047b62a 100644 --- a/authentik/providers/saml/views.py +++ b/authentik/providers/saml/views.py @@ -270,6 +270,7 @@ class MetadataImportView(LoginRequiredMixin, FormView): form.cleaned_data["metadata"].read().decode() ) provider = metadata.to_provider(form.cleaned_data["provider_name"]) + provider.authorization_flow = form.cleaned_data["authorization_flow"] provider.save() messages.success(self.request, _("Successfully created Provider")) except ValueError as exc: