providers/oauth2: fix token login event args not set correctly

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer 2023-02-05 00:45:54 +01:00
parent de389e2385
commit 66aabcc371
No known key found for this signature in database
1 changed files with 8 additions and 4 deletions

View File

@ -25,6 +25,7 @@ from authentik.core.models import (
User, User,
) )
from authentik.events.models import Event, EventAction 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.lib.utils.time import timedelta_from_string
from authentik.policies.engine import PolicyEngine from authentik.policies.engine import PolicyEngine
from authentik.providers.oauth2.constants import ( 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.providers.oauth2.utils import TokenResponse, cors_allow, extract_client_auth
from authentik.sources.oauth.models import OAuthSource from authentik.sources.oauth.models import OAuthSource
from authentik.stages.password.stage import PLAN_CONTEXT_METHOD, PLAN_CONTEXT_METHOD_ARGS
LOGGER = get_logger() LOGGER = get_logger()
@ -281,11 +283,13 @@ class TokenParams:
Event.new( Event.new(
action=EventAction.LOGIN, action=EventAction.LOGIN,
PLAN_CONTEXT_METHOD="token", **{
PLAN_CONTEXT_METHOD_ARGS={ PLAN_CONTEXT_METHOD: "token",
PLAN_CONTEXT_METHOD_ARGS: {
"identifier": token.identifier, "identifier": token.identifier,
}, },
PLAN_CONTEXT_APPLICATION=app, PLAN_CONTEXT_APPLICATION: app,
},
).from_http(request, user=user) ).from_http(request, user=user)
return None return None