From 64c48285d287d1626b058316f4a6e5858e151ceb Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 5 Sep 2023 19:32:58 +0200 Subject: [PATCH] set auth_via when using mobile token Signed-off-by: Jens Langhammer --- authentik/stages/authenticator_mobile/api/auth.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/authentik/stages/authenticator_mobile/api/auth.py b/authentik/stages/authenticator_mobile/api/auth.py index 2ccecf5e5..9c88d4973 100644 --- a/authentik/stages/authenticator_mobile/api/auth.py +++ b/authentik/stages/authenticator_mobile/api/auth.py @@ -6,6 +6,7 @@ from rest_framework.authentication import BaseAuthentication, get_authorization_ from rest_framework.request import Request from authentik.api.authentication import validate_auth +from authentik.core.middleware import CTX_AUTH_VIA from authentik.core.models import User from authentik.stages.authenticator_mobile.models import MobileDeviceToken @@ -20,7 +21,7 @@ class MobileDeviceTokenAuthentication(BaseAuthentication): device_token: MobileDeviceToken = MobileDeviceToken.objects.filter(token=raw_token).first() if not device_token: return None - + CTX_AUTH_VIA.set("mobile_token") return (device_token.user, None)