set auth_via when using mobile token
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
757d179ae5
commit
a8f825545f
|
@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue