From 86b69e83e0ac61117c39a3a04ab47201e0bb71f4 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 24 Jul 2023 23:30:18 +0200 Subject: [PATCH] change enrollment to post Signed-off-by: Jens Langhammer --- authentik/stages/authenticator_mobile/api.py | 17 ++++++++++++----- schema.yml | 13 ++++++++++--- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/authentik/stages/authenticator_mobile/api.py b/authentik/stages/authenticator_mobile/api.py index dd6be6c96..4816aec93 100644 --- a/authentik/stages/authenticator_mobile/api.py +++ b/authentik/stages/authenticator_mobile/api.py @@ -30,10 +30,6 @@ class AuthenticatorMobileStageSerializer(StageSerializer): "configure_flow", "friendly_name", ] - # extra_kwargs = { - # "client_secret": {"write_only": True}, - # "admin_secret_key": {"write_only": True}, - # } class AuthenticatorMobileStageViewSet(UsedByMixin, ModelViewSet): @@ -48,7 +44,18 @@ class AuthenticatorMobileStageViewSet(UsedByMixin, ModelViewSet): search_fields = ["name"] ordering = ["name"] - @action(methods=["GET"], detail=True) + @extend_schema( + request=OpenApiTypes.NONE, + responses={ + 200: inline_serializer( + "MobileDeviceEnrollmentCallbackSerializer", + { + "device_token": CharField(required=True), + }, + ), + }, + ) + @action(methods=["POST"], detail=True, permission_classes=[]) def enrollment_callback(self, request: Request, pk: str) -> Response: pass diff --git a/schema.yml b/schema.yml index 3b66b428d..a3603e5ee 100644 --- a/schema.yml +++ b/schema.yml @@ -23422,8 +23422,8 @@ paths: $ref: '#/components/schemas/GenericError' description: '' /stages/authenticator/mobile/{stage_uuid}/enrollment_callback/: - get: - operationId: stages_authenticator_mobile_enrollment_callback_retrieve + post: + operationId: stages_authenticator_mobile_enrollment_callback_create description: AuthenticatorMobileStage Viewset parameters: - in: path @@ -23442,7 +23442,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/AuthenticatorMobileStage' + $ref: '#/components/schemas/MobileDeviceEnrollmentCallback' description: '' '400': content: @@ -35122,6 +35122,13 @@ components: required: - name - pk + MobileDeviceEnrollmentCallback: + type: object + properties: + device_token: + type: string + required: + - device_token MobileDeviceRequest: type: object description: Serializer for Mobile authenticator devices