set auth_via when using mobile token

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer 2023-09-05 19:32:58 +02:00
parent 268c5c7c6d
commit 64c48285d2
No known key found for this signature in database
1 changed files with 2 additions and 1 deletions

View File

@ -6,6 +6,7 @@ from rest_framework.authentication import BaseAuthentication, get_authorization_
from rest_framework.request import Request from rest_framework.request import Request
from authentik.api.authentication import validate_auth from authentik.api.authentication import validate_auth
from authentik.core.middleware import CTX_AUTH_VIA
from authentik.core.models import User from authentik.core.models import User
from authentik.stages.authenticator_mobile.models import MobileDeviceToken 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() device_token: MobileDeviceToken = MobileDeviceToken.objects.filter(token=raw_token).first()
if not device_token: if not device_token:
return None return None
CTX_AUTH_VIA.set("mobile_token")
return (device_token.user, None) return (device_token.user, None)