diff options
author | Joas Schilling <coding@schilljs.com> | 2023-06-30 14:14:36 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-07-03 14:25:01 +0200 |
commit | 05aa39d777039c07de4e10b1b2aae8223e2b63df (patch) | |
tree | da29654da60513d8bf1720c5ddea72de7905a706 /lib/private/Authentication | |
parent | 1d5beb368862020b49fe1cc840e9b1c7eb3f6931 (diff) | |
download | nextcloud-server-05aa39d777039c07de4e10b1b2aae8223e2b63df.tar.gz nextcloud-server-05aa39d777039c07de4e10b1b2aae8223e2b63df.zip |
Fix event names of 2FA related typed events
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Authentication')
3 files changed, 13 insertions, 3 deletions
diff --git a/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php b/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php index 19d80218562..4817c6b8de0 100644 --- a/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php +++ b/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php @@ -69,7 +69,7 @@ class ProviderUserAssignmentDao { /** * Persist a new/updated (provider_id, uid, enabled) tuple */ - public function persist(string $providerId, string $uid, int $enabled) { + public function persist(string $providerId, string $uid, int $enabled): void { $qb = $this->conn->getQueryBuilder(); try { @@ -96,7 +96,7 @@ class ProviderUserAssignmentDao { * * @param string $uid * - * @return int[] + * @return list<array{provider_id: string, uid: string, enabled: bool}> */ public function deleteByUser(string $uid): array { $qb1 = $this->conn->getQueryBuilder(); @@ -122,7 +122,7 @@ class ProviderUserAssignmentDao { }, $rows); } - public function deleteAll(string $providerId) { + public function deleteAll(string $providerId): void { $qb = $this->conn->getQueryBuilder(); $deleteQuery = $qb->delete(self::TABLE_NAME) diff --git a/lib/private/Authentication/TwoFactorAuth/Manager.php b/lib/private/Authentication/TwoFactorAuth/Manager.php index 7e115cf9b42..17937de4e44 100644 --- a/lib/private/Authentication/TwoFactorAuth/Manager.php +++ b/lib/private/Authentication/TwoFactorAuth/Manager.php @@ -36,6 +36,8 @@ use OCP\AppFramework\Utility\ITimeFactory; use OCP\Authentication\TwoFactorAuth\IActivatableAtLogin; use OCP\Authentication\TwoFactorAuth\IProvider; use OCP\Authentication\TwoFactorAuth\IRegistry; +use OCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengeFailed; +use OCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengePassed; use OCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserDisabled; use OCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserEnabled; use OCP\EventDispatcher\IEventDispatcher; @@ -286,6 +288,7 @@ class Manager { $this->legacyDispatcher->dispatch(IProvider::EVENT_SUCCESS, $dispatchEvent); $this->dispatcher->dispatchTyped(new TwoFactorProviderForUserEnabled($user, $provider)); + $this->dispatcher->dispatchTyped(new TwoFactorProviderChallengePassed($user, $provider)); $this->publishEvent($user, 'twofactor_success', [ 'provider' => $provider->getDisplayName(), @@ -295,6 +298,7 @@ class Manager { $this->legacyDispatcher->dispatch(IProvider::EVENT_FAILED, $dispatchEvent); $this->dispatcher->dispatchTyped(new TwoFactorProviderForUserDisabled($user, $provider)); + $this->dispatcher->dispatchTyped(new TwoFactorProviderChallengeFailed($user, $provider)); $this->publishEvent($user, 'twofactor_failed', [ 'provider' => $provider->getDisplayName(), diff --git a/lib/private/Authentication/TwoFactorAuth/Registry.php b/lib/private/Authentication/TwoFactorAuth/Registry.php index 6c82572578c..482c025e144 100644 --- a/lib/private/Authentication/TwoFactorAuth/Registry.php +++ b/lib/private/Authentication/TwoFactorAuth/Registry.php @@ -31,6 +31,9 @@ use OCP\Authentication\TwoFactorAuth\IProvider; use OCP\Authentication\TwoFactorAuth\IRegistry; use OCP\Authentication\TwoFactorAuth\RegistryEvent; use OCP\Authentication\TwoFactorAuth\TwoFactorProviderDisabled; +use OCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserRegistered; +use OCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserUnregistered; +use OCP\Authentication\TwoFactorAuth\TwoFactorProviderUserDeleted; use OCP\EventDispatcher\IEventDispatcher; use OCP\IUser; @@ -56,6 +59,7 @@ class Registry implements IRegistry { $event = new RegistryEvent($provider, $user); $this->dispatcher->dispatch(self::EVENT_PROVIDER_ENABLED, $event); + $this->dispatcher->dispatchTyped(new TwoFactorProviderForUserRegistered($user, $provider)); } public function disableProviderFor(IProvider $provider, IUser $user) { @@ -63,12 +67,14 @@ class Registry implements IRegistry { $event = new RegistryEvent($provider, $user); $this->dispatcher->dispatch(self::EVENT_PROVIDER_DISABLED, $event); + $this->dispatcher->dispatchTyped(new TwoFactorProviderForUserUnregistered($user, $provider)); } public function deleteUserData(IUser $user): void { foreach ($this->assignmentDao->deleteByUser($user->getUID()) as $provider) { $event = new TwoFactorProviderDisabled($provider['provider_id']); $this->dispatcher->dispatchTyped($event); + $this->dispatcher->dispatchTyped(new TwoFactorProviderUserDeleted($user, $provider['provider_id'])); } } |