* providers/saml: add basic metadata parser * providers/saml: add importer for Singing certificate, validate signature, add tests * providers/saml: add provider name to form, * web: don't use trailing slash for spa URLs * providers/saml: formatting fixes * sources/*: add verbose_name to source serializers * admin: add button launch import modal
31 lines
882 B
Python
31 lines
882 B
Python
"""OAuth Source Serializer"""
|
|
from rest_framework.serializers import ModelSerializer
|
|
from rest_framework.viewsets import ModelViewSet
|
|
|
|
from authentik.admin.forms.source import SOURCE_SERIALIZER_FIELDS
|
|
from authentik.core.api.utils import MetaNameSerializer
|
|
from authentik.sources.oauth.models import OAuthSource
|
|
|
|
|
|
class OAuthSourceSerializer(ModelSerializer, MetaNameSerializer):
|
|
"""OAuth Source Serializer"""
|
|
|
|
class Meta:
|
|
model = OAuthSource
|
|
fields = SOURCE_SERIALIZER_FIELDS + [
|
|
"provider_type",
|
|
"request_token_url",
|
|
"authorization_url",
|
|
"access_token_url",
|
|
"profile_url",
|
|
"consumer_key",
|
|
"consumer_secret",
|
|
]
|
|
|
|
|
|
class OAuthSourceViewSet(ModelViewSet):
|
|
"""Source Viewset"""
|
|
|
|
queryset = OAuthSource.objects.all()
|
|
serializer_class = OAuthSourceSerializer
|