From 66aabcc371d47960670fdac346d94974592b5675 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 5 Feb 2023 00:45:54 +0100 Subject: [PATCH] providers/oauth2: fix token login event args not set correctly Signed-off-by: Jens Langhammer --- authentik/providers/oauth2/views/token.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/authentik/providers/oauth2/views/token.py b/authentik/providers/oauth2/views/token.py index 4e34e1f3b..e171cf379 100644 --- a/authentik/providers/oauth2/views/token.py +++ b/authentik/providers/oauth2/views/token.py @@ -25,6 +25,7 @@ from authentik.core.models import ( User, ) from authentik.events.models import Event, EventAction +from authentik.flows.planner import PLAN_CONTEXT_APPLICATION from authentik.lib.utils.time import timedelta_from_string from authentik.policies.engine import PolicyEngine from authentik.providers.oauth2.constants import ( @@ -47,6 +48,7 @@ from authentik.providers.oauth2.models import ( ) from authentik.providers.oauth2.utils import TokenResponse, cors_allow, extract_client_auth from authentik.sources.oauth.models import OAuthSource +from authentik.stages.password.stage import PLAN_CONTEXT_METHOD, PLAN_CONTEXT_METHOD_ARGS LOGGER = get_logger() @@ -281,11 +283,13 @@ class TokenParams: Event.new( action=EventAction.LOGIN, - PLAN_CONTEXT_METHOD="token", - PLAN_CONTEXT_METHOD_ARGS={ - "identifier": token.identifier, + **{ + PLAN_CONTEXT_METHOD: "token", + PLAN_CONTEXT_METHOD_ARGS: { + "identifier": token.identifier, + }, + PLAN_CONTEXT_APPLICATION: app, }, - PLAN_CONTEXT_APPLICATION=app, ).from_http(request, user=user) return None