Merge pull request from Icinga/feature/send-failed-login-attempts-to-the-audit-log-3855

Send failed login-attempts to the audit log
This commit is contained in:
Johannes Meyer 2019-07-12 14:00:09 +02:00 committed by GitHub
commit 5d87f6712e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,6 +3,7 @@
namespace Icinga\Authentication;
use Icinga\Application\Hook\AuditHook;
use Iterator;
use Icinga\Application\Config;
use Icinga\Application\Logger;
@ -123,13 +124,17 @@ class AuthChain implements Authenticatable, Iterator
return true;
}
}
if ($backendsTried === 0) {
$this->error = static::EEMPTY;
} elseif ($backendsTried === $backendsWithError) {
$this->error = static::EFAIL;
} elseif ($backendsWithError) {
$this->error = static::ENOTALL;
} else {
AuditHook::logActivity('login-failed', 'User failed to authenticate', null, $user->getUsername());
}
return false;
}