providers/saml: force user to select authz flow for import
This commit is contained in:
parent
e69834dec4
commit
d0ee7908ab
|
@ -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"])]
|
||||||
)
|
)
|
||||||
|
|
|
@ -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:
|
||||||
|
|
Reference in New Issue