From 5c05e0f5d30b829486d5d29ee53ccd5aee78d72c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rimas=20Misevi=C4=8Dius?= <rmisev3@gmail.com> Date: Fri, 31 May 2019 13:36:18 +0300 Subject: [PATCH] Add logging for organizational logins This adds the same logging to UserPassOrgBase::handleLogin function as it is in the UserPassBase::handleLogin (UserPassBase.php) --- modules/core/lib/Auth/UserPassOrgBase.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/core/lib/Auth/UserPassOrgBase.php b/modules/core/lib/Auth/UserPassOrgBase.php index 6eca0d095..8a5e867f5 100644 --- a/modules/core/lib/Auth/UserPassOrgBase.php +++ b/modules/core/lib/Auth/UserPassOrgBase.php @@ -291,7 +291,14 @@ abstract class UserPassOrgBase extends \SimpleSAML\Auth\Source } /* Attempt to log in. */ - $attributes = $source->login($username, $password, $organization); + try { + $attributes = $source->login($username, $password, $organization); + } catch (\Exception $e) { + \SimpleSAML\Logger::stats('Unsuccessful login attempt from '.$_SERVER['REMOTE_ADDR'].'.'); + throw $e; + } + + \SimpleSAML\Logger::stats('User \''.$username.'\' at \''.$organization.'\' successfully authenticated from '.$_SERVER['REMOTE_ADDR']); // Add the selected Org to the state $state[self::ORGID] = $organization; -- GitLab