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

38 lines
1.1 KiB
Python
Raw Normal View History

2019-11-07 16:02:56 +00:00
"""passbook SAML SP Forms"""
from django import forms
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.utils.translation import gettext as _
2019-11-07 16:02:56 +00:00
from passbook.admin.forms.source import SOURCE_FORM_FIELDS
from passbook.providers.saml.utils.cert import CertificateBuilder
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)
builder = CertificateBuilder()
builder.build()
2019-12-31 11:51:16 +00:00
self.fields["signing_cert"].initial = builder.certificate
2019-11-07 16:02:56 +00:00
class Meta:
model = SAMLSource
2019-12-31 11:51:16 +00:00
fields = SOURCE_FORM_FIELDS + [
"entity_id",
"idp_url",
"idp_logout_url",
"auto_logout",
"signing_cert",
]
2019-11-07 16:02:56 +00:00
widgets = {
2019-12-31 11:51:16 +00:00
"name": forms.TextInput(),
"policies": FilteredSelectMultiple(_("policies"), False),
"entity_id": forms.TextInput(),
"idp_url": forms.TextInput(),
"idp_logout_url": forms.TextInput(),
2019-11-07 16:02:56 +00:00
}