providers/saml: force user to select authz flow for import

This commit is contained in:
Jens Langhammer 2020-12-30 22:02:41 +01:00
parent e69834dec4
commit d0ee7908ab
2 changed files with 4 additions and 0 deletions

View File

@ -94,6 +94,9 @@ class SAMLProviderImportForm(forms.Form):
"""Create a SAML Provider from SP Metadata.""" """Create a SAML Provider from SP Metadata."""
provider_name = forms.CharField() provider_name = forms.CharField()
authorization_flow = forms.ModelChoiceField(
queryset=Flow.objects.filter(designation=FlowDesignation.AUTHORIZATION)
)
metadata = forms.FileField( metadata = forms.FileField(
validators=[FileExtensionValidator(allowed_extensions=["xml"])] validators=[FileExtensionValidator(allowed_extensions=["xml"])]
) )

View File

@ -270,6 +270,7 @@ class MetadataImportView(LoginRequiredMixin, FormView):
form.cleaned_data["metadata"].read().decode() form.cleaned_data["metadata"].read().decode()
) )
provider = metadata.to_provider(form.cleaned_data["provider_name"]) provider = metadata.to_provider(form.cleaned_data["provider_name"])
provider.authorization_flow = form.cleaned_data["authorization_flow"]
provider.save() provider.save()
messages.success(self.request, _("Successfully created Provider")) messages.success(self.request, _("Successfully created Provider"))
except ValueError as exc: except ValueError as exc: