From 3e02d5aff85babc3ffbfcf52313f2108e313aa23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 13:46:43 +0200 Subject: Adding upstream version 2.12.1. Signed-off-by: Daniel Baumann --- .../Icinga/Application/Hook/AuthenticationHook.php | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 library/Icinga/Application/Hook/AuthenticationHook.php (limited to 'library/Icinga/Application/Hook/AuthenticationHook.php') diff --git a/library/Icinga/Application/Hook/AuthenticationHook.php b/library/Icinga/Application/Hook/AuthenticationHook.php new file mode 100644 index 0000000..41cc661 --- /dev/null +++ b/library/Icinga/Application/Hook/AuthenticationHook.php @@ -0,0 +1,75 @@ +onLogin($user); + } catch (\Exception $e) { + // Avoid error propagation if login failed in third party application + Logger::error($e); + } + } + } + + /** + * Call the onLogout() method of all registered AuthHook(s) + * + * @param User $user + */ + public static function triggerLogout(User $user) + { + /** @var AuthenticationHook $hook */ + foreach (Hook::all(self::NAME) as $hook) { + try { + $hook->onLogout($user); + } catch (\Exception $e) { + // Avoid error propagation if login failed in third party application + Logger::error($e); + } + } + } +} -- cgit v1.2.3