core: move UILoginButtonSerializer into core
This commit is contained in:
parent
511f94fc7f
commit
7a9140bdcd
|
@ -1,6 +1,10 @@
|
||||||
"""authentik core dataclasses"""
|
"""authentik core dataclasses"""
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
from rest_framework.fields import CharField
|
||||||
|
|
||||||
|
from rest_framework.serializers import Serializer
|
||||||
|
from django.db.models.base import Model
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
@ -15,3 +19,17 @@ class UILoginButton:
|
||||||
|
|
||||||
# Icon URL, used as-is
|
# Icon URL, used as-is
|
||||||
icon_url: Optional[str] = None
|
icon_url: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
|
class UILoginButtonSerializer(Serializer):
|
||||||
|
"""Serializer for Login buttons of sources"""
|
||||||
|
|
||||||
|
name = CharField()
|
||||||
|
url = CharField()
|
||||||
|
icon_url = CharField()
|
||||||
|
|
||||||
|
def create(self, validated_data: dict) -> Model:
|
||||||
|
return Model()
|
||||||
|
|
||||||
|
def update(self, instance: Model, validated_data: dict) -> Model:
|
||||||
|
return Model()
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
"""Identification stage logic"""
|
"""Identification stage logic"""
|
||||||
|
from authentik.core.types import UILoginButtonSerializer
|
||||||
from dataclasses import asdict
|
from dataclasses import asdict
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.db.models.base import Model
|
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from rest_framework.fields import CharField
|
from rest_framework.fields import CharField
|
||||||
from rest_framework.serializers import Serializer, ValidationError
|
from rest_framework.serializers import ValidationError
|
||||||
from structlog.stdlib import get_logger
|
from structlog.stdlib import get_logger
|
||||||
|
|
||||||
from authentik.core.api.applications import ApplicationSerializer
|
from authentik.core.api.applications import ApplicationSerializer
|
||||||
|
@ -25,20 +25,6 @@ from authentik.stages.identification.models import IdentificationStage, UserFiel
|
||||||
LOGGER = get_logger()
|
LOGGER = get_logger()
|
||||||
|
|
||||||
|
|
||||||
class UILoginButtonSerializer(Serializer):
|
|
||||||
"""Serializer for Login buttons of sources"""
|
|
||||||
|
|
||||||
name = CharField()
|
|
||||||
url = CharField()
|
|
||||||
icon_url = CharField()
|
|
||||||
|
|
||||||
def create(self, validated_data: dict) -> Model:
|
|
||||||
return Model()
|
|
||||||
|
|
||||||
def update(self, instance: Model, validated_data: dict) -> Model:
|
|
||||||
return Model()
|
|
||||||
|
|
||||||
|
|
||||||
class IdentificationChallenge(Challenge):
|
class IdentificationChallenge(Challenge):
|
||||||
"""Identification challenges with all UI elements"""
|
"""Identification challenges with all UI elements"""
|
||||||
|
|
||||||
|
|
Reference in New Issue