fix web to support string for device uuid
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
82b9d337d4
commit
2c1d1c0075
|
@ -1,7 +1,7 @@
|
|||
"""Authenticator Devices API Views"""
|
||||
from drf_spectacular.types import OpenApiTypes
|
||||
from drf_spectacular.utils import OpenApiParameter, extend_schema
|
||||
from rest_framework.fields import BooleanField, CharField, IntegerField, SerializerMethodField
|
||||
from rest_framework.fields import BooleanField, CharField, SerializerMethodField
|
||||
from rest_framework.permissions import IsAdminUser, IsAuthenticated
|
||||
from rest_framework.request import Request
|
||||
from rest_framework.response import Response
|
||||
|
@ -15,10 +15,10 @@ from authentik.stages.authenticator.models import Device
|
|||
class DeviceSerializer(MetaNameSerializer):
|
||||
"""Serializer for Duo authenticator devices"""
|
||||
|
||||
pk = IntegerField()
|
||||
pk = CharField()
|
||||
name = CharField()
|
||||
type = SerializerMethodField()
|
||||
confirmed = BooleanField()
|
||||
confirmed = BooleanField(read_only=True)
|
||||
|
||||
def get_type(self, instance: Device) -> str:
|
||||
"""Get type of device"""
|
||||
|
|
|
@ -11,12 +11,12 @@ from rest_framework.filters import OrderingFilter, SearchFilter
|
|||
from rest_framework.permissions import IsAdminUser
|
||||
from rest_framework.request import Request
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.serializers import ModelSerializer
|
||||
from rest_framework.viewsets import GenericViewSet, ModelViewSet
|
||||
from structlog.stdlib import get_logger
|
||||
|
||||
from authentik.api.authorization import OwnerFilter, OwnerPermissions
|
||||
from authentik.api.decorators import permission_required
|
||||
from authentik.core.api.devices import DeviceSerializer
|
||||
from authentik.core.api.used_by import UsedByMixin
|
||||
from authentik.flows.api.stages import StageSerializer
|
||||
from authentik.stages.authenticator_duo.models import AuthenticatorDuoStage, DuoDevice
|
||||
|
@ -165,7 +165,7 @@ class AuthenticatorDuoStageViewSet(UsedByMixin, ModelViewSet):
|
|||
return Response(data=result, status=200 if result["error"] == "" else 400)
|
||||
|
||||
|
||||
class DuoDeviceSerializer(ModelSerializer):
|
||||
class DuoDeviceSerializer(DeviceSerializer):
|
||||
"""Serializer for Duo authenticator devices"""
|
||||
|
||||
class Meta:
|
||||
|
|
|
@ -10,10 +10,10 @@ from rest_framework.filters import OrderingFilter, SearchFilter
|
|||
from rest_framework.permissions import IsAdminUser
|
||||
from rest_framework.request import Request
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.serializers import ModelSerializer
|
||||
from rest_framework.viewsets import GenericViewSet, ModelViewSet
|
||||
|
||||
from authentik.api.authorization import OwnerFilter, OwnerPermissions
|
||||
from authentik.core.api.devices import DeviceSerializer
|
||||
from authentik.core.api.used_by import UsedByMixin
|
||||
from authentik.core.api.utils import PassiveSerializer
|
||||
from authentik.stages.authenticator_mobile.api.auth import MobileDeviceTokenAuthentication
|
||||
|
@ -36,7 +36,7 @@ class MobileDeviceInfoSerializer(PassiveSerializer):
|
|||
others = JSONField()
|
||||
|
||||
|
||||
class MobileDeviceSerializer(ModelSerializer):
|
||||
class MobileDeviceSerializer(DeviceSerializer):
|
||||
"""Serializer for Mobile authenticator devices"""
|
||||
|
||||
last_checkin = MobileDeviceInfoSerializer(read_only=True)
|
||||
|
|
|
@ -3,10 +3,10 @@ from django_filters.rest_framework.backends import DjangoFilterBackend
|
|||
from rest_framework import mixins
|
||||
from rest_framework.filters import OrderingFilter, SearchFilter
|
||||
from rest_framework.permissions import IsAdminUser
|
||||
from rest_framework.serializers import ModelSerializer
|
||||
from rest_framework.viewsets import GenericViewSet, ModelViewSet
|
||||
|
||||
from authentik.api.authorization import OwnerFilter, OwnerPermissions
|
||||
from authentik.core.api.devices import DeviceSerializer
|
||||
from authentik.core.api.used_by import UsedByMixin
|
||||
from authentik.flows.api.stages import StageSerializer
|
||||
from authentik.stages.authenticator_sms.models import AuthenticatorSMSStage, SMSDevice
|
||||
|
@ -41,7 +41,7 @@ class AuthenticatorSMSStageViewSet(UsedByMixin, ModelViewSet):
|
|||
search_fields = ["name"]
|
||||
|
||||
|
||||
class SMSDeviceSerializer(ModelSerializer):
|
||||
class SMSDeviceSerializer(DeviceSerializer):
|
||||
"""Serializer for sms authenticator devices"""
|
||||
|
||||
class Meta:
|
||||
|
|
|
@ -7,6 +7,7 @@ from rest_framework.serializers import ModelSerializer
|
|||
from rest_framework.viewsets import GenericViewSet, ModelViewSet
|
||||
|
||||
from authentik.api.authorization import OwnerFilter, OwnerPermissions
|
||||
from authentik.core.api.devices import DeviceSerializer
|
||||
from authentik.core.api.used_by import UsedByMixin
|
||||
from authentik.flows.api.stages import StageSerializer
|
||||
from authentik.stages.authenticator_static.models import (
|
||||
|
@ -47,7 +48,7 @@ class StaticDeviceTokenSerializer(ModelSerializer):
|
|||
fields = ["token"]
|
||||
|
||||
|
||||
class StaticDeviceSerializer(ModelSerializer):
|
||||
class StaticDeviceSerializer(DeviceSerializer):
|
||||
"""Serializer for static authenticator devices"""
|
||||
|
||||
token_set = StaticDeviceTokenSerializer(many=True, read_only=True)
|
||||
|
|
|
@ -4,10 +4,10 @@ from rest_framework import mixins
|
|||
from rest_framework.fields import ChoiceField
|
||||
from rest_framework.filters import OrderingFilter, SearchFilter
|
||||
from rest_framework.permissions import IsAdminUser
|
||||
from rest_framework.serializers import ModelSerializer
|
||||
from rest_framework.viewsets import GenericViewSet, ModelViewSet
|
||||
|
||||
from authentik.api.authorization import OwnerFilter, OwnerPermissions
|
||||
from authentik.core.api.devices import DeviceSerializer
|
||||
from authentik.core.api.used_by import UsedByMixin
|
||||
from authentik.flows.api.stages import StageSerializer
|
||||
from authentik.stages.authenticator_totp.models import (
|
||||
|
@ -37,7 +37,7 @@ class AuthenticatorTOTPStageViewSet(UsedByMixin, ModelViewSet):
|
|||
search_fields = ["name"]
|
||||
|
||||
|
||||
class TOTPDeviceSerializer(ModelSerializer):
|
||||
class TOTPDeviceSerializer(DeviceSerializer):
|
||||
"""Serializer for totp authenticator devices"""
|
||||
|
||||
class Meta:
|
||||
|
|
|
@ -3,10 +3,10 @@ from django_filters.rest_framework.backends import DjangoFilterBackend
|
|||
from rest_framework import mixins
|
||||
from rest_framework.filters import OrderingFilter, SearchFilter
|
||||
from rest_framework.permissions import IsAdminUser
|
||||
from rest_framework.serializers import ModelSerializer
|
||||
from rest_framework.viewsets import GenericViewSet, ModelViewSet
|
||||
|
||||
from authentik.api.authorization import OwnerFilter, OwnerPermissions
|
||||
from authentik.core.api.devices import DeviceSerializer
|
||||
from authentik.core.api.used_by import UsedByMixin
|
||||
from authentik.flows.api.stages import StageSerializer
|
||||
from authentik.stages.authenticator_webauthn.models import AuthenticateWebAuthnStage, WebAuthnDevice
|
||||
|
@ -36,7 +36,7 @@ class AuthenticateWebAuthnStageViewSet(UsedByMixin, ModelViewSet):
|
|||
search_fields = ["name"]
|
||||
|
||||
|
||||
class WebAuthnDeviceSerializer(ModelSerializer):
|
||||
class WebAuthnDeviceSerializer(DeviceSerializer):
|
||||
"""Serializer for WebAuthn authenticator devices"""
|
||||
|
||||
class Meta:
|
||||
|
|
|
@ -5910,12 +5910,15 @@
|
|||
"model_authentik_stages_authenticator_duo.duodevice": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pk": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"title": "Pk"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"maxLength": 64,
|
||||
"minLength": 1,
|
||||
"title": "Name",
|
||||
"description": "The human-readable name of this device."
|
||||
"title": "Name"
|
||||
}
|
||||
},
|
||||
"required": []
|
||||
|
@ -6045,20 +6048,13 @@
|
|||
"properties": {
|
||||
"pk": {
|
||||
"type": "string",
|
||||
"format": "uuid",
|
||||
"title": "Uuid"
|
||||
"minLength": 1,
|
||||
"title": "Pk"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"maxLength": 64,
|
||||
"minLength": 1,
|
||||
"title": "Name",
|
||||
"description": "The human-readable name of this device."
|
||||
},
|
||||
"state": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"title": "State"
|
||||
"title": "Name"
|
||||
}
|
||||
},
|
||||
"required": []
|
||||
|
@ -6217,12 +6213,15 @@
|
|||
"model_authentik_stages_authenticator_sms.smsdevice": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pk": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"title": "Pk"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"maxLength": 64,
|
||||
"minLength": 1,
|
||||
"title": "Name",
|
||||
"description": "The human-readable name of this device."
|
||||
"title": "Name"
|
||||
}
|
||||
},
|
||||
"required": []
|
||||
|
@ -6348,12 +6347,15 @@
|
|||
"model_authentik_stages_authenticator_static.staticdevice": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pk": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"title": "Pk"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"maxLength": 64,
|
||||
"minLength": 1,
|
||||
"title": "Name",
|
||||
"description": "The human-readable name of this device."
|
||||
"title": "Name"
|
||||
}
|
||||
},
|
||||
"required": []
|
||||
|
@ -6475,12 +6477,15 @@
|
|||
"model_authentik_stages_authenticator_totp.totpdevice": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pk": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"title": "Pk"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"maxLength": 64,
|
||||
"minLength": 1,
|
||||
"title": "Name",
|
||||
"description": "The human-readable name of this device."
|
||||
"title": "Name"
|
||||
}
|
||||
},
|
||||
"required": []
|
||||
|
@ -6768,9 +6773,13 @@
|
|||
"model_authentik_stages_authenticator_webauthn.webauthndevice": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pk": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"title": "Pk"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"maxLength": 200,
|
||||
"minLength": 1,
|
||||
"title": "Name"
|
||||
}
|
||||
|
|
259
schema.yml
259
schema.yml
|
@ -31008,7 +31008,7 @@ components:
|
|||
description: Return internal model name
|
||||
readOnly: true
|
||||
pk:
|
||||
type: integer
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
type:
|
||||
|
@ -31017,6 +31017,7 @@ components:
|
|||
readOnly: true
|
||||
confirmed:
|
||||
type: boolean
|
||||
readOnly: true
|
||||
required:
|
||||
- confirmed
|
||||
- meta_model_name
|
||||
|
@ -31342,17 +31343,37 @@ components:
|
|||
type: object
|
||||
description: Serializer for Duo authenticator devices
|
||||
properties:
|
||||
pk:
|
||||
type: integer
|
||||
verbose_name:
|
||||
type: string
|
||||
description: Return object's verbose_name
|
||||
readOnly: true
|
||||
title: ID
|
||||
verbose_name_plural:
|
||||
type: string
|
||||
description: Return object's plural verbose_name
|
||||
readOnly: true
|
||||
meta_model_name:
|
||||
type: string
|
||||
description: Return internal model name
|
||||
readOnly: true
|
||||
pk:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
description: The human-readable name of this device.
|
||||
maxLength: 64
|
||||
type:
|
||||
type: string
|
||||
description: Get type of device
|
||||
readOnly: true
|
||||
confirmed:
|
||||
type: boolean
|
||||
readOnly: true
|
||||
required:
|
||||
- confirmed
|
||||
- meta_model_name
|
||||
- name
|
||||
- pk
|
||||
- type
|
||||
- verbose_name
|
||||
- verbose_name_plural
|
||||
DuoDeviceEnrollmentStatus:
|
||||
type: object
|
||||
properties:
|
||||
|
@ -31364,13 +31385,15 @@ components:
|
|||
type: object
|
||||
description: Serializer for Duo authenticator devices
|
||||
properties:
|
||||
pk:
|
||||
type: string
|
||||
minLength: 1
|
||||
name:
|
||||
type: string
|
||||
minLength: 1
|
||||
description: The human-readable name of this device.
|
||||
maxLength: 64
|
||||
required:
|
||||
- name
|
||||
- pk
|
||||
DuoResponseEnum:
|
||||
enum:
|
||||
- success
|
||||
|
@ -34322,24 +34345,42 @@ components:
|
|||
type: object
|
||||
description: Serializer for Mobile authenticator devices
|
||||
properties:
|
||||
verbose_name:
|
||||
type: string
|
||||
description: Return object's verbose_name
|
||||
readOnly: true
|
||||
verbose_name_plural:
|
||||
type: string
|
||||
description: Return object's plural verbose_name
|
||||
readOnly: true
|
||||
meta_model_name:
|
||||
type: string
|
||||
description: Return internal model name
|
||||
readOnly: true
|
||||
pk:
|
||||
type: string
|
||||
format: uuid
|
||||
title: Uuid
|
||||
name:
|
||||
type: string
|
||||
description: The human-readable name of this device.
|
||||
maxLength: 64
|
||||
state:
|
||||
type: object
|
||||
additionalProperties: {}
|
||||
type:
|
||||
type: string
|
||||
description: Get type of device
|
||||
readOnly: true
|
||||
confirmed:
|
||||
type: boolean
|
||||
readOnly: true
|
||||
last_checkin:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/MobileDeviceInfo'
|
||||
readOnly: true
|
||||
required:
|
||||
- confirmed
|
||||
- last_checkin
|
||||
- meta_model_name
|
||||
- name
|
||||
- pk
|
||||
- type
|
||||
- verbose_name
|
||||
- verbose_name_plural
|
||||
MobileDeviceEnrollmentCallback:
|
||||
type: object
|
||||
properties:
|
||||
|
@ -34432,18 +34473,13 @@ components:
|
|||
properties:
|
||||
pk:
|
||||
type: string
|
||||
format: uuid
|
||||
title: Uuid
|
||||
minLength: 1
|
||||
name:
|
||||
type: string
|
||||
minLength: 1
|
||||
description: The human-readable name of this device.
|
||||
maxLength: 64
|
||||
state:
|
||||
type: object
|
||||
additionalProperties: {}
|
||||
required:
|
||||
- name
|
||||
- pk
|
||||
MobileDeviceResponseRequest:
|
||||
type: object
|
||||
description: Response from push sent to phone
|
||||
|
@ -37483,11 +37519,12 @@ components:
|
|||
type: object
|
||||
description: Serializer for Duo authenticator devices
|
||||
properties:
|
||||
pk:
|
||||
type: string
|
||||
minLength: 1
|
||||
name:
|
||||
type: string
|
||||
minLength: 1
|
||||
description: The human-readable name of this device.
|
||||
maxLength: 64
|
||||
PatchedEmailStageRequest:
|
||||
type: object
|
||||
description: EmailStage Serializer
|
||||
|
@ -38217,16 +38254,10 @@ components:
|
|||
properties:
|
||||
pk:
|
||||
type: string
|
||||
format: uuid
|
||||
title: Uuid
|
||||
minLength: 1
|
||||
name:
|
||||
type: string
|
||||
minLength: 1
|
||||
description: The human-readable name of this device.
|
||||
maxLength: 64
|
||||
state:
|
||||
type: object
|
||||
additionalProperties: {}
|
||||
PatchedNotificationRequest:
|
||||
type: object
|
||||
description: Notification Serializer
|
||||
|
@ -39211,11 +39242,12 @@ components:
|
|||
type: object
|
||||
description: Serializer for sms authenticator devices
|
||||
properties:
|
||||
pk:
|
||||
type: string
|
||||
minLength: 1
|
||||
name:
|
||||
type: string
|
||||
minLength: 1
|
||||
description: The human-readable name of this device.
|
||||
maxLength: 64
|
||||
PatchedScopeMappingRequest:
|
||||
type: object
|
||||
description: ScopeMapping Serializer
|
||||
|
@ -39247,20 +39279,22 @@ components:
|
|||
type: object
|
||||
description: Serializer for static authenticator devices
|
||||
properties:
|
||||
pk:
|
||||
type: string
|
||||
minLength: 1
|
||||
name:
|
||||
type: string
|
||||
minLength: 1
|
||||
description: The human-readable name of this device.
|
||||
maxLength: 64
|
||||
PatchedTOTPDeviceRequest:
|
||||
type: object
|
||||
description: Serializer for totp authenticator devices
|
||||
properties:
|
||||
pk:
|
||||
type: string
|
||||
minLength: 1
|
||||
name:
|
||||
type: string
|
||||
minLength: 1
|
||||
description: The human-readable name of this device.
|
||||
maxLength: 64
|
||||
PatchedTenantRequest:
|
||||
type: object
|
||||
description: Tenant Serializer
|
||||
|
@ -39481,10 +39515,12 @@ components:
|
|||
type: object
|
||||
description: Serializer for WebAuthn authenticator devices
|
||||
properties:
|
||||
pk:
|
||||
type: string
|
||||
minLength: 1
|
||||
name:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 200
|
||||
Permission:
|
||||
type: object
|
||||
description: Global permission
|
||||
|
@ -41958,32 +41994,50 @@ components:
|
|||
type: object
|
||||
description: Serializer for sms authenticator devices
|
||||
properties:
|
||||
verbose_name:
|
||||
type: string
|
||||
description: Return object's verbose_name
|
||||
readOnly: true
|
||||
verbose_name_plural:
|
||||
type: string
|
||||
description: Return object's plural verbose_name
|
||||
readOnly: true
|
||||
meta_model_name:
|
||||
type: string
|
||||
description: Return internal model name
|
||||
readOnly: true
|
||||
pk:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
description: The human-readable name of this device.
|
||||
maxLength: 64
|
||||
pk:
|
||||
type: integer
|
||||
readOnly: true
|
||||
title: ID
|
||||
phone_number:
|
||||
type:
|
||||
type: string
|
||||
description: Get type of device
|
||||
readOnly: true
|
||||
confirmed:
|
||||
type: boolean
|
||||
readOnly: true
|
||||
required:
|
||||
- confirmed
|
||||
- meta_model_name
|
||||
- name
|
||||
- phone_number
|
||||
- pk
|
||||
- type
|
||||
- verbose_name
|
||||
- verbose_name_plural
|
||||
SMSDeviceRequest:
|
||||
type: object
|
||||
description: Serializer for sms authenticator devices
|
||||
properties:
|
||||
pk:
|
||||
type: string
|
||||
minLength: 1
|
||||
name:
|
||||
type: string
|
||||
minLength: 1
|
||||
description: The human-readable name of this device.
|
||||
maxLength: 64
|
||||
required:
|
||||
- name
|
||||
- pk
|
||||
ScopeMapping:
|
||||
type: object
|
||||
description: ScopeMapping Serializer
|
||||
|
@ -42481,34 +42535,56 @@ components:
|
|||
type: object
|
||||
description: Serializer for static authenticator devices
|
||||
properties:
|
||||
verbose_name:
|
||||
type: string
|
||||
description: Return object's verbose_name
|
||||
readOnly: true
|
||||
verbose_name_plural:
|
||||
type: string
|
||||
description: Return object's plural verbose_name
|
||||
readOnly: true
|
||||
meta_model_name:
|
||||
type: string
|
||||
description: Return internal model name
|
||||
readOnly: true
|
||||
pk:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
description: The human-readable name of this device.
|
||||
maxLength: 64
|
||||
type:
|
||||
type: string
|
||||
description: Get type of device
|
||||
readOnly: true
|
||||
confirmed:
|
||||
type: boolean
|
||||
readOnly: true
|
||||
token_set:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/StaticDeviceToken'
|
||||
readOnly: true
|
||||
pk:
|
||||
type: integer
|
||||
readOnly: true
|
||||
title: ID
|
||||
required:
|
||||
- confirmed
|
||||
- meta_model_name
|
||||
- name
|
||||
- pk
|
||||
- token_set
|
||||
- type
|
||||
- verbose_name
|
||||
- verbose_name_plural
|
||||
StaticDeviceRequest:
|
||||
type: object
|
||||
description: Serializer for static authenticator devices
|
||||
properties:
|
||||
pk:
|
||||
type: string
|
||||
minLength: 1
|
||||
name:
|
||||
type: string
|
||||
minLength: 1
|
||||
description: The human-readable name of this device.
|
||||
maxLength: 64
|
||||
required:
|
||||
- name
|
||||
- pk
|
||||
StaticDeviceToken:
|
||||
type: object
|
||||
description: Serializer for static device's tokens
|
||||
|
@ -42611,28 +42687,50 @@ components:
|
|||
type: object
|
||||
description: Serializer for totp authenticator devices
|
||||
properties:
|
||||
verbose_name:
|
||||
type: string
|
||||
description: Return object's verbose_name
|
||||
readOnly: true
|
||||
verbose_name_plural:
|
||||
type: string
|
||||
description: Return object's plural verbose_name
|
||||
readOnly: true
|
||||
meta_model_name:
|
||||
type: string
|
||||
description: Return internal model name
|
||||
readOnly: true
|
||||
pk:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
description: The human-readable name of this device.
|
||||
maxLength: 64
|
||||
pk:
|
||||
type: integer
|
||||
type:
|
||||
type: string
|
||||
description: Get type of device
|
||||
readOnly: true
|
||||
confirmed:
|
||||
type: boolean
|
||||
readOnly: true
|
||||
title: ID
|
||||
required:
|
||||
- confirmed
|
||||
- meta_model_name
|
||||
- name
|
||||
- pk
|
||||
- type
|
||||
- verbose_name
|
||||
- verbose_name_plural
|
||||
TOTPDeviceRequest:
|
||||
type: object
|
||||
description: Serializer for totp authenticator devices
|
||||
properties:
|
||||
pk:
|
||||
type: string
|
||||
minLength: 1
|
||||
name:
|
||||
type: string
|
||||
minLength: 1
|
||||
description: The human-readable name of this device.
|
||||
maxLength: 64
|
||||
required:
|
||||
- name
|
||||
- pk
|
||||
Task:
|
||||
type: object
|
||||
description: Serialize TaskInfo and TaskResult
|
||||
|
@ -43927,31 +44025,50 @@ components:
|
|||
type: object
|
||||
description: Serializer for WebAuthn authenticator devices
|
||||
properties:
|
||||
pk:
|
||||
type: integer
|
||||
verbose_name:
|
||||
type: string
|
||||
description: Return object's verbose_name
|
||||
readOnly: true
|
||||
title: ID
|
||||
verbose_name_plural:
|
||||
type: string
|
||||
description: Return object's plural verbose_name
|
||||
readOnly: true
|
||||
meta_model_name:
|
||||
type: string
|
||||
description: Return internal model name
|
||||
readOnly: true
|
||||
pk:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
maxLength: 200
|
||||
created_on:
|
||||
type:
|
||||
type: string
|
||||
format: date-time
|
||||
description: Get type of device
|
||||
readOnly: true
|
||||
confirmed:
|
||||
type: boolean
|
||||
readOnly: true
|
||||
required:
|
||||
- created_on
|
||||
- confirmed
|
||||
- meta_model_name
|
||||
- name
|
||||
- pk
|
||||
- type
|
||||
- verbose_name
|
||||
- verbose_name_plural
|
||||
WebAuthnDeviceRequest:
|
||||
type: object
|
||||
description: Serializer for WebAuthn authenticator devices
|
||||
properties:
|
||||
pk:
|
||||
type: string
|
||||
minLength: 1
|
||||
name:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 200
|
||||
required:
|
||||
- name
|
||||
- pk
|
||||
Workers:
|
||||
type: object
|
||||
properties:
|
||||
|
|
|
@ -464,24 +464,42 @@ components:
|
|||
type: object
|
||||
description: Serializer for Mobile authenticator devices
|
||||
properties:
|
||||
verbose_name:
|
||||
type: string
|
||||
description: Return object's verbose_name
|
||||
readOnly: true
|
||||
verbose_name_plural:
|
||||
type: string
|
||||
description: Return object's plural verbose_name
|
||||
readOnly: true
|
||||
meta_model_name:
|
||||
type: string
|
||||
description: Return internal model name
|
||||
readOnly: true
|
||||
pk:
|
||||
type: string
|
||||
format: uuid
|
||||
title: Uuid
|
||||
name:
|
||||
type: string
|
||||
description: The human-readable name of this device.
|
||||
maxLength: 64
|
||||
state:
|
||||
type: object
|
||||
additionalProperties: {}
|
||||
type:
|
||||
type: string
|
||||
description: Get type of device
|
||||
readOnly: true
|
||||
confirmed:
|
||||
type: boolean
|
||||
readOnly: true
|
||||
last_checkin:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/MobileDeviceInfo'
|
||||
readOnly: true
|
||||
required:
|
||||
- confirmed
|
||||
- last_checkin
|
||||
- meta_model_name
|
||||
- name
|
||||
- pk
|
||||
- type
|
||||
- verbose_name
|
||||
- verbose_name_plural
|
||||
MobileDeviceEnrollmentCallback:
|
||||
type: object
|
||||
properties:
|
||||
|
@ -566,18 +584,13 @@ components:
|
|||
properties:
|
||||
pk:
|
||||
type: string
|
||||
format: uuid
|
||||
title: Uuid
|
||||
minLength: 1
|
||||
name:
|
||||
type: string
|
||||
minLength: 1
|
||||
description: The human-readable name of this device.
|
||||
maxLength: 64
|
||||
state:
|
||||
type: object
|
||||
additionalProperties: {}
|
||||
required:
|
||||
- name
|
||||
- pk
|
||||
MobileDeviceResponseRequest:
|
||||
type: object
|
||||
description: Response from push sent to phone
|
||||
|
@ -643,16 +656,10 @@ components:
|
|||
properties:
|
||||
pk:
|
||||
type: string
|
||||
format: uuid
|
||||
title: Uuid
|
||||
minLength: 1
|
||||
name:
|
||||
type: string
|
||||
minLength: 1
|
||||
description: The human-readable name of this device.
|
||||
maxLength: 64
|
||||
state:
|
||||
type: object
|
||||
additionalProperties: {}
|
||||
PlatformEnum:
|
||||
enum:
|
||||
- ios
|
||||
|
|
|
@ -49,18 +49,21 @@ export class UserDeviceTable extends Table<Device> {
|
|||
|
||||
async deleteWrapper(device: Device) {
|
||||
const api = new AuthenticatorsApi(DEFAULT_CONFIG);
|
||||
const id = { id: device.pk };
|
||||
switch (device.type) {
|
||||
case "authentik_stages_authenticator_duo.DuoDevice":
|
||||
return api.authenticatorsAdminDuoDestroy(id);
|
||||
case "authentik_stages_authenticator_sms.SMSDevice":
|
||||
return api.authenticatorsAdminSmsDestroy(id);
|
||||
case "authentik_stages_authenticator_totp.TOTPDevice":
|
||||
return api.authenticatorsAdminTotpDestroy(id);
|
||||
case "authentik_stages_authenticator_static.StaticDevice":
|
||||
return api.authenticatorsAdminStaticDestroy(id);
|
||||
case "authentik_stages_authenticator_webauthn.WebAuthnDevice":
|
||||
return api.authenticatorsAdminWebauthnDestroy(id);
|
||||
switch (device.type.toLowerCase()) {
|
||||
case "authentik_stages_authenticator_duo.duodevice":
|
||||
return api.authenticatorsAdminDuoDestroy({ id: parseInt(device.pk, 10) });
|
||||
case "authentik_stages_authenticator_sms.smsdevice":
|
||||
return api.authenticatorsAdminSmsDestroy({ id: parseInt(device.pk, 10) });
|
||||
case "authentik_stages_authenticator_totp.totpdevice":
|
||||
return api.authenticatorsAdminTotpDestroy({ id: parseInt(device.pk, 10) });
|
||||
case "authentik_stages_authenticator_static.staticdevice":
|
||||
return api.authenticatorsAdminStaticDestroy({ id: parseInt(device.pk, 10) });
|
||||
case "authentik_stages_authenticator_webauthn.webauthndevice":
|
||||
return api.authenticatorsAdminWebauthnDestroy({ id: parseInt(device.pk, 10) });
|
||||
case "authentik_stages_authenticator_mobile.mobiledevice":
|
||||
return api.authenticatorsMobileDestroy({
|
||||
uuid: device.pk,
|
||||
});
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -10,11 +10,11 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|||
import { AuthenticatorsApi, Device } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-user-mfa-form")
|
||||
export class MFADeviceForm extends ModelForm<Device, number> {
|
||||
export class MFADeviceForm extends ModelForm<Device, string> {
|
||||
@property()
|
||||
deviceType!: string;
|
||||
|
||||
async loadInstance(pk: number): Promise<Device> {
|
||||
async loadInstance(pk: string): Promise<Device> {
|
||||
const devices = await new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsAllList();
|
||||
return devices.filter((device) => {
|
||||
return device.pk === pk && device.type === this.deviceType;
|
||||
|
@ -26,37 +26,43 @@ export class MFADeviceForm extends ModelForm<Device, number> {
|
|||
}
|
||||
|
||||
async send(device: Device): Promise<Device> {
|
||||
switch (this.instance?.type) {
|
||||
case "authentik_stages_authenticator_duo.DuoDevice":
|
||||
switch (this.instance?.type.toLowerCase()) {
|
||||
case "authentik_stages_authenticator_duo.duodevice":
|
||||
await new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsDuoUpdate({
|
||||
id: this.instance?.pk,
|
||||
id: parseInt(this.instance?.pk, 10),
|
||||
duoDeviceRequest: device,
|
||||
});
|
||||
break;
|
||||
case "authentik_stages_authenticator_sms.SMSDevice":
|
||||
case "authentik_stages_authenticator_sms.smsdevice":
|
||||
await new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsSmsUpdate({
|
||||
id: this.instance?.pk,
|
||||
id: parseInt(this.instance?.pk, 10),
|
||||
sMSDeviceRequest: device,
|
||||
});
|
||||
break;
|
||||
case "authentik_stages_authenticator_totp.TOTPDevice":
|
||||
case "authentik_stages_authenticator_totp.totpdevice":
|
||||
await new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsTotpUpdate({
|
||||
id: this.instance?.pk,
|
||||
id: parseInt(this.instance?.pk, 10),
|
||||
tOTPDeviceRequest: device,
|
||||
});
|
||||
break;
|
||||
case "authentik_stages_authenticator_static.StaticDevice":
|
||||
case "authentik_stages_authenticator_static.staticdevice":
|
||||
await new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsStaticUpdate({
|
||||
id: this.instance?.pk,
|
||||
id: parseInt(this.instance?.pk, 10),
|
||||
staticDeviceRequest: device,
|
||||
});
|
||||
break;
|
||||
case "authentik_stages_authenticator_webauthn.WebAuthnDevice":
|
||||
case "authentik_stages_authenticator_webauthn.webauthndevice":
|
||||
await new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsWebauthnUpdate({
|
||||
id: this.instance?.pk,
|
||||
id: parseInt(this.instance?.pk, 10),
|
||||
webAuthnDeviceRequest: device,
|
||||
});
|
||||
break;
|
||||
case "authentik_stages_authenticator_mobile.mobiledevice":
|
||||
await new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorsMobileUpdate({
|
||||
uuid: this.instance?.pk,
|
||||
mobileDeviceRequest: device,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -85,21 +85,20 @@ export class MFADevicesPage extends Table<Device> {
|
|||
|
||||
async deleteWrapper(device: Device) {
|
||||
const api = new AuthenticatorsApi(DEFAULT_CONFIG);
|
||||
const id = { id: device.pk };
|
||||
switch (device.type) {
|
||||
case "authentik_stages_authenticator_duo.DuoDevice":
|
||||
return api.authenticatorsDuoDestroy(id);
|
||||
case "authentik_stages_authenticator_sms.SMSDevice":
|
||||
return api.authenticatorsSmsDestroy(id);
|
||||
case "authentik_stages_authenticator_totp.TOTPDevice":
|
||||
return api.authenticatorsTotpDestroy(id);
|
||||
case "authentik_stages_authenticator_static.StaticDevice":
|
||||
return api.authenticatorsStaticDestroy(id);
|
||||
case "authentik_stages_authenticator_webauthn.WebAuthnDevice":
|
||||
return api.authenticatorsWebauthnDestroy(id);
|
||||
switch (device.type.toLowerCase()) {
|
||||
case "authentik_stages_authenticator_duo.duodevice":
|
||||
return api.authenticatorsDuoDestroy({ id: parseInt(device.pk, 10) });
|
||||
case "authentik_stages_authenticator_sms.smsdevice":
|
||||
return api.authenticatorsSmsDestroy({ id: parseInt(device.pk, 10) });
|
||||
case "authentik_stages_authenticator_totp.totpdevice":
|
||||
return api.authenticatorsTotpDestroy({ id: parseInt(device.pk, 10) });
|
||||
case "authentik_stages_authenticator_static.staticdevice":
|
||||
return api.authenticatorsStaticDestroy({ id: parseInt(device.pk, 10) });
|
||||
case "authentik_stages_authenticator_webauthn.webauthndevice":
|
||||
return api.authenticatorsWebauthnDestroy({ id: parseInt(device.pk, 10) });
|
||||
case "authentik_stages_authenticator_mobile.mobiledevice":
|
||||
return api.authenticatorsMobileDestroy({
|
||||
uuid: device.pk as unknown as string,
|
||||
uuid: device.pk,
|
||||
});
|
||||
default:
|
||||
break;
|
||||
|
|
Reference in New Issue