From 3f66bd743722f86b69dd8094f2a3e5c62b2e5bca Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 16 Apr 2018 16:19:03 +0200 Subject: [PATCH] Auth: Log login/logout activities to the audit log refs #2563 --- library/Icinga/Authentication/Auth.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/Icinga/Authentication/Auth.php b/library/Icinga/Authentication/Auth.php index d3974113b..27e1ac98c 100644 --- a/library/Icinga/Authentication/Auth.php +++ b/library/Icinga/Authentication/Auth.php @@ -5,6 +5,7 @@ namespace Icinga\Authentication; use Exception; use Icinga\Application\Config; +use Icinga\Application\Hook\AuditHook; use Icinga\Application\Icinga; use Icinga\Application\Logger; use Icinga\Authentication\User\ExternalBackend; @@ -164,6 +165,7 @@ class Auth if ($persist) { $this->persistCurrentUser(); } + AuditHook::logActivity('login', 'User {{username}} logged in', ['username' => $user->getUsername()]); } /** @@ -362,6 +364,7 @@ class Auth */ public function removeAuthorization() { + AuditHook::logActivity('logout', 'User {{username}} logged out', ['username' => $this->user->getUsername()]); $this->user = null; Session::getSession()->purge(); }