This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/passbook/sources/saml/forms.py

46 lines
1.4 KiB
Python
Raw Normal View History

2019-11-07 16:02:56 +00:00
"""passbook SAML SP Forms"""
from django import forms
from passbook.admin.forms.source import SOURCE_FORM_FIELDS
from passbook.crypto.models import CertificateKeyPair
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"""
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(
certificate_data__isnull=False, key_data__isnull=False,
)
2019-11-07 16:02:56 +00:00
class Meta:
model = SAMLSource
2019-12-31 11:51:16 +00:00
fields = SOURCE_FORM_FIELDS + [
"issuer",
"sso_url",
"name_id_policy",
"binding_type",
"slo_url",
"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(),
"issuer": forms.TextInput(),
"sso_url": forms.TextInput(),
"slo_url": forms.TextInput(),
"temporary_user_delete_after": forms.TextInput(),
2019-11-07 16:02:56 +00:00
}