allow setting firebase api key while sending enrollment callback

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer 2024-01-02 22:59:43 +01:00
parent c90d35b113
commit 76498a2d7b
No known key found for this signature in database
3 changed files with 16 additions and 7 deletions

View File

@ -53,19 +53,19 @@ class MobileDeviceCheckInSerializer(PassiveSerializer):
info = MobileDeviceInfoSerializer()
class MobileDeviceEnrollmentSerializer(PassiveSerializer):
"""Enrollment request, send the device's unique identifier"""
device_uid = CharField(required=True)
info = MobileDeviceInfoSerializer()
class MobileDeviceSetPushKeySerializer(PassiveSerializer):
"""Set notification key"""
firebase_key = CharField(required=True)
class MobileDeviceEnrollmentSerializer(MobileDeviceSetPushKeySerializer):
"""Enrollment request, send the device's unique identifier"""
device_uid = CharField(required=True)
info = MobileDeviceInfoSerializer()
class MobileDeviceResponseSerializer(PassiveSerializer):
"""Response from push sent to phone"""
@ -120,6 +120,7 @@ class MobileDeviceViewSet(
device.name = data.validated_data["info"]["hostname"]
device.confirmed = True
device.device_id = data.validated_data["device_uid"]
device.firebase_token = data.validated_data["firebase_key"]
device.save()
MobileDeviceToken.objects.filter(
device=device,

View File

@ -35380,6 +35380,9 @@ components:
type: object
description: Enrollment request, send the device's unique identifier
properties:
firebase_key:
type: string
minLength: 1
device_uid:
type: string
minLength: 1
@ -35387,6 +35390,7 @@ components:
$ref: '#/components/schemas/MobileDeviceInfoRequest'
required:
- device_uid
- firebase_key
- info
MobileDeviceEnrollmentStatus:
type: object

View File

@ -511,6 +511,9 @@ components:
type: object
description: Enrollment request, send the device's unique identifier
properties:
firebase_key:
type: string
minLength: 1
device_uid:
type: string
minLength: 1
@ -518,6 +521,7 @@ components:
$ref: '#/components/schemas/MobileDeviceInfoRequest'
required:
- device_uid
- firebase_key
- info
MobileDeviceEnrollmentStatus:
type: object