2019-11-07 16:02:56 +00:00
|
|
|
"""passbook SAML SP Forms"""
|
|
|
|
|
|
|
|
from django import forms
|
|
|
|
|
2019-11-07 16:28:59 +00:00
|
|
|
from passbook.admin.forms.source import SOURCE_FORM_FIELDS
|
2020-07-12 15:22:26 +00:00
|
|
|
from passbook.crypto.models import CertificateKeyPair
|
2020-07-12 15:55:09 +00:00
|
|
|
from passbook.flows.models import Flow, FlowDesignation
|
2019-11-07 16:02:56 +00:00
|
|
|
from passbook.sources.saml.models import SAMLSource
|
|
|
|
|
|
|
|
|
|
|
|
class SAMLSourceForm(forms.ModelForm):
|
|
|
|
"""SAML Provider form"""
|
|
|
|
|
2020-08-01 18:00:20 +00:00
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super().__init__(*args, **kwargs)
|
|
|
|
|
|
|
|
self.fields["authentication_flow"].queryset = Flow.objects.filter(
|
|
|
|
designation=FlowDesignation.AUTHENTICATION
|
|
|
|
)
|
|
|
|
self.fields["enrollment_flow"].queryset = Flow.objects.filter(
|
|
|
|
designation=FlowDesignation.ENROLLMENT
|
|
|
|
)
|
|
|
|
self.fields["signing_kp"].queryset = CertificateKeyPair.objects.filter(
|
2020-09-30 17:34:22 +00:00
|
|
|
certificate_data__isnull=False,
|
|
|
|
key_data__isnull=False,
|
2020-08-01 18:00:20 +00:00
|
|
|
)
|
2020-07-08 12:18:08 +00:00
|
|
|
|
2019-11-07 16:02:56 +00:00
|
|
|
class Meta:
|
|
|
|
|
|
|
|
model = SAMLSource
|
2019-12-31 11:51:16 +00:00
|
|
|
fields = SOURCE_FORM_FIELDS + [
|
2020-02-20 20:33:45 +00:00
|
|
|
"issuer",
|
2020-06-24 20:27:14 +00:00
|
|
|
"sso_url",
|
|
|
|
"slo_url",
|
2020-09-11 22:53:38 +00:00
|
|
|
"binding_type",
|
|
|
|
"name_id_policy",
|
|
|
|
"allow_idp_initiated",
|
2020-06-24 20:27:14 +00:00
|
|
|
"temporary_user_delete_after",
|
2020-03-03 22:35:38 +00:00
|
|
|
"signing_kp",
|
2019-12-31 11:51:16 +00:00
|
|
|
]
|
2019-11-07 16:02:56 +00:00
|
|
|
widgets = {
|
2019-12-31 11:51:16 +00:00
|
|
|
"name": forms.TextInput(),
|
2020-02-20 20:33:45 +00:00
|
|
|
"issuer": forms.TextInput(),
|
2020-06-24 20:27:14 +00:00
|
|
|
"sso_url": forms.TextInput(),
|
|
|
|
"slo_url": forms.TextInput(),
|
|
|
|
"temporary_user_delete_after": forms.TextInput(),
|
2019-11-07 16:02:56 +00:00
|
|
|
}
|