From 72bb02d39004299364a57fc0cd9cf36dacea8a3e Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Wed, 26 Jun 2013 16:48:07 +0200 Subject: [PATCH] Module administration Rebase fix ldap auth for testing issue. refs #4092 --- .../Authentication/Backend/LdapUserBackend.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/library/Icinga/Authentication/Backend/LdapUserBackend.php b/library/Icinga/Authentication/Backend/LdapUserBackend.php index d51a784b6..afaf13ec5 100644 --- a/library/Icinga/Authentication/Backend/LdapUserBackend.php +++ b/library/Icinga/Authentication/Backend/LdapUserBackend.php @@ -8,6 +8,7 @@ use Icinga\Authentication\User as User; use Icinga\Authentication\UserBackend; use Icinga\Authentication\Credentials; use Icinga\Protocol\Ldap; +use Icinga\Application\Config; class LdapUserBackend implements UserBackend { @@ -33,8 +34,16 @@ class LdapUserBackend implements UserBackend protected function selectUsername($username) { return $this->connection->select() - ->from('user', array('sAMAccountName')) - ->where('sAMAccountName', $this->stripAsterisks($username)); + ->from( + Config::getInstance()->authentication->users->user_class, + array( + Config::getInstance()->authentication->users->user_name_attribute + ) + ) + ->where( + Config::getInstance()->authentication->users->user_name_attribute, + $this->stripAsterisks($username) + ); } public function authenticate(Credentials $credentials) @@ -42,7 +51,8 @@ class LdapUserBackend implements UserBackend if (!$this->connection->testCredentials( $this->connection->fetchDN($this->selectUsername($credentials->getUsername())), $credentials->getPassword() - ) ) { + ) + ) { return false; } $user = new User($credentials->getUsername());