2023-07-24 03:52:25 +00:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2021-12-09 07:47:21 +00:00
|
|
|
from rest_framework import serializers
|
|
|
|
|
|
|
|
__all__ = [
|
|
|
|
'SAML2SettingSerializer',
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
class SAML2SettingSerializer(serializers.Serializer):
|
2023-02-23 08:38:44 +00:00
|
|
|
PREFIX_TITLE = _('SAML2')
|
2022-11-04 06:22:38 +00:00
|
|
|
|
2021-12-09 07:47:21 +00:00
|
|
|
AUTH_SAML2 = serializers.BooleanField(
|
2024-02-26 08:53:40 +00:00
|
|
|
default=False, required=False, label=_('SAML2')
|
2021-12-09 07:47:21 +00:00
|
|
|
)
|
|
|
|
SAML2_IDP_METADATA_URL = serializers.URLField(
|
2024-02-27 03:25:42 +00:00
|
|
|
allow_blank=True, required=False, label=_('IDP Metadata URL')
|
2021-12-09 07:47:21 +00:00
|
|
|
)
|
|
|
|
SAML2_IDP_METADATA_XML = serializers.CharField(
|
2024-02-27 03:25:42 +00:00
|
|
|
allow_blank=True, required=False, label=_('IDP Metadata XML')
|
2021-12-09 07:47:21 +00:00
|
|
|
)
|
2021-12-13 02:54:14 +00:00
|
|
|
SAML2_SP_ADVANCED_SETTINGS = serializers.JSONField(
|
2021-12-14 09:57:39 +00:00
|
|
|
required=False, label=_('SP advanced settings')
|
2021-12-13 02:54:14 +00:00
|
|
|
)
|
2021-12-09 07:47:21 +00:00
|
|
|
SAML2_SP_KEY_CONTENT = serializers.CharField(
|
|
|
|
allow_blank=True, required=False,
|
2021-12-14 09:57:39 +00:00
|
|
|
write_only=True, label=_('SP private key')
|
2021-12-09 07:47:21 +00:00
|
|
|
)
|
|
|
|
SAML2_SP_CERT_CONTENT = serializers.CharField(
|
|
|
|
allow_blank=True, required=False,
|
2021-12-14 09:57:39 +00:00
|
|
|
write_only=True, label=_('SP cert')
|
2021-12-09 07:47:21 +00:00
|
|
|
)
|
2024-02-26 08:53:40 +00:00
|
|
|
SAML2_RENAME_ATTRIBUTES = serializers.JSONField(required=False, label=_('User attribute'))
|
2021-12-09 07:47:21 +00:00
|
|
|
SAML2_LOGOUT_COMPLETELY = serializers.BooleanField(required=False, label=_('Logout completely'))
|
|
|
|
AUTH_SAML2_ALWAYS_UPDATE_USER = serializers.BooleanField(required=False, label=_('Always update user'))
|