sources/oauth: add choices to oauth provider_type
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
bb8e0c6f59
commit
2df4322ecf
|
@ -3,7 +3,7 @@ from django.urls.base import reverse_lazy
|
|||
from drf_spectacular.types import OpenApiTypes
|
||||
from drf_spectacular.utils import OpenApiParameter, extend_schema, extend_schema_field
|
||||
from rest_framework.decorators import action
|
||||
from rest_framework.fields import BooleanField, CharField, SerializerMethodField
|
||||
from rest_framework.fields import BooleanField, CharField, ChoiceField, SerializerMethodField
|
||||
from rest_framework.request import Request
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.serializers import ValidationError
|
||||
|
@ -31,6 +31,7 @@ class SourceTypeSerializer(PassiveSerializer):
|
|||
class OAuthSourceSerializer(SourceSerializer):
|
||||
"""OAuth Source Serializer"""
|
||||
|
||||
provider_type = ChoiceField(choices=MANAGER.get_name_tuple())
|
||||
callback_url = SerializerMethodField()
|
||||
|
||||
def get_callback_url(self, instance: OAuthSource) -> str:
|
||||
|
|
21
schema.yml
21
schema.yml
|
@ -22668,8 +22668,7 @@ components:
|
|||
description: How the source determines if an existing user should be authenticated
|
||||
or a new user enrolled.
|
||||
provider_type:
|
||||
type: string
|
||||
maxLength: 255
|
||||
$ref: '#/components/schemas/ProviderTypeEnum'
|
||||
request_token_url:
|
||||
type: string
|
||||
nullable: true
|
||||
|
@ -22743,8 +22742,7 @@ components:
|
|||
description: How the source determines if an existing user should be authenticated
|
||||
or a new user enrolled.
|
||||
provider_type:
|
||||
type: string
|
||||
maxLength: 255
|
||||
$ref: '#/components/schemas/ProviderTypeEnum'
|
||||
request_token_url:
|
||||
type: string
|
||||
nullable: true
|
||||
|
@ -26806,8 +26804,7 @@ components:
|
|||
description: How the source determines if an existing user should be authenticated
|
||||
or a new user enrolled.
|
||||
provider_type:
|
||||
type: string
|
||||
maxLength: 255
|
||||
$ref: '#/components/schemas/ProviderTypeEnum'
|
||||
request_token_url:
|
||||
type: string
|
||||
nullable: true
|
||||
|
@ -28209,6 +28206,18 @@ components:
|
|||
required:
|
||||
- authorization_flow
|
||||
- name
|
||||
ProviderTypeEnum:
|
||||
enum:
|
||||
- apple
|
||||
- azuread
|
||||
- discord
|
||||
- facebook
|
||||
- github
|
||||
- google
|
||||
- openidconnect
|
||||
- reddit
|
||||
- twitter
|
||||
type: string
|
||||
ProxyMode:
|
||||
enum:
|
||||
- proxy
|
||||
|
|
Reference in New Issue