From f8ef2b666f63e8757f5eb7dd28a1cf4f648b7fb4 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 25 Nov 2022 11:53:05 +0100 Subject: [PATCH] events: fix incorrect EventAction being used Signed-off-by: Jens Langhammer --- authentik/events/signals.py | 2 +- authentik/providers/oauth2/models.py | 2 +- tests/e2e/test_provider_ldap.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/authentik/events/signals.py b/authentik/events/signals.py index d959d3d7a..1d20a1805 100644 --- a/authentik/events/signals.py +++ b/authentik/events/signals.py @@ -65,7 +65,7 @@ def on_login_failed( **kwargs, ): """Failed Login, authentik custom event""" - Event.new(EventAction.USER_WRITE, **credentials, stage=stage, **kwargs).from_http(request) + Event.new(EventAction.LOGIN_FAILED, **credentials, stage=stage, **kwargs).from_http(request) @receiver(invitation_used) diff --git a/authentik/providers/oauth2/models.py b/authentik/providers/oauth2/models.py index 128a32a23..3b9136567 100644 --- a/authentik/providers/oauth2/models.py +++ b/authentik/providers/oauth2/models.py @@ -29,7 +29,6 @@ from authentik.providers.oauth2.apps import AuthentikProviderOAuth2Config from authentik.providers.oauth2.constants import ( ACR_AUTHENTIK_DEFAULT, AMR_MFA, - AMR_OTP, AMR_PASSWORD, AMR_WEBAUTHN, ) @@ -474,6 +473,7 @@ class RefreshToken(SerializerModel, ExpiringModel, BaseGrantModel): token["uid"] = generate_key() return self.provider.encode(token) + # pylint: disable=too-many-locals def create_id_token(self, user: User, request: HttpRequest) -> IDToken: """Creates the id_token. See: http://openid.net/specs/openid-connect-core-1_0.html#IDToken""" diff --git a/tests/e2e/test_provider_ldap.py b/tests/e2e/test_provider_ldap.py index 479408c72..dae09b742 100644 --- a/tests/e2e/test_provider_ldap.py +++ b/tests/e2e/test_provider_ldap.py @@ -156,7 +156,7 @@ class TestProviderLDAP(SeleniumTestCase): Event.objects.filter( action=EventAction.LOGIN_FAILED, user={"pk": anon.pk, "email": anon.email, "username": anon.username}, - ) + ).exists(), ) @retry()