core: add additional_data to UILoginButton to pass additional data
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
40a885aaaa
commit
19708bc67b
|
@ -1,8 +1,8 @@
|
|||
"""authentik core dataclasses"""
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
from typing import Any, Optional
|
||||
|
||||
from rest_framework.fields import CharField
|
||||
from rest_framework.fields import CharField, DictField
|
||||
|
||||
from authentik.core.api.utils import PassiveSerializer
|
||||
|
||||
|
@ -20,6 +20,9 @@ class UILoginButton:
|
|||
# Icon URL, used as-is
|
||||
icon_url: Optional[str] = None
|
||||
|
||||
# Additional data, optional
|
||||
additional_data: Any = None
|
||||
|
||||
|
||||
class UILoginButtonSerializer(PassiveSerializer):
|
||||
"""Serializer for Login buttons of sources"""
|
||||
|
@ -27,6 +30,7 @@ class UILoginButtonSerializer(PassiveSerializer):
|
|||
name = CharField()
|
||||
url = CharField()
|
||||
icon_url = CharField(required=False, allow_null=True)
|
||||
additional_data = DictField(required=False, allow_null=True)
|
||||
|
||||
|
||||
class UserSettingSerializer(PassiveSerializer):
|
||||
|
|
|
@ -115,6 +115,7 @@ class TestIdentificationStage(TestCase):
|
|||
"title": self.flow.title,
|
||||
"sources": [
|
||||
{
|
||||
"additional_data": None,
|
||||
"icon_url": "/static/authentik/sources/.svg",
|
||||
"name": "test",
|
||||
"url": "/source/oauth/login/test/",
|
||||
|
@ -158,6 +159,7 @@ class TestIdentificationStage(TestCase):
|
|||
"title": self.flow.title,
|
||||
"sources": [
|
||||
{
|
||||
"additional_data": None,
|
||||
"icon_url": "/static/authentik/sources/.svg",
|
||||
"name": "test",
|
||||
"url": "/source/oauth/login/test/",
|
||||
|
|
Reference in a new issue