use uuid for mobile token

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer 2023-12-18 12:37:49 +01:00
parent 2c71d5714b
commit e496d86e2b
No known key found for this signature in database
3 changed files with 8 additions and 9 deletions

View File

@ -1,4 +1,4 @@
# Generated by Django 4.2.7 on 2023-12-15 16:02
# Generated by Django 4.2.7 on 2023-12-18 11:37
import uuid
@ -14,8 +14,8 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("authentik_flows", "0027_auto_20231028_1424"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
@ -127,17 +127,15 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name="MobileDeviceToken",
fields=[
(
"id",
models.AutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
(
"expires",
models.DateTimeField(default=authentik.core.models.default_token_duration),
),
("expiring", models.BooleanField(default=True)),
(
"token_uuid",
models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False),
),
(
"token",
models.TextField(

View File

@ -227,6 +227,7 @@ class MobileTransaction(ExpiringModel):
class MobileDeviceToken(ExpiringModel):
"""Mobile device token"""
token_uuid = models.UUIDField(default=uuid4, primary_key=True)
device = models.ForeignKey(MobileDevice, on_delete=models.CASCADE, null=True)
user = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)
token = models.TextField(default=default_token_key)

View File

@ -5739,8 +5739,8 @@ paths:
tags:
- core
security:
- authentik: []
- mobile_device_token: []
- authentik: []
responses:
'200':
content: