Skip to content

Commit

Permalink
Module administration
Browse files Browse the repository at this point in the history
Rebase fix ldap auth for testing issue.

refs #4092
  • Loading branch information
mxhash committed Jun 26, 2013
1 parent d1f4e98 commit 72bb02d
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions library/Icinga/Authentication/Backend/LdapUserBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Icinga\Authentication\UserBackend;
use Icinga\Authentication\Credentials;
use Icinga\Protocol\Ldap;
use Icinga\Application\Config;

class LdapUserBackend implements UserBackend
{
Expand All @@ -33,16 +34,25 @@ protected function stripAsterisks($string)
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)
{
if (!$this->connection->testCredentials(
$this->connection->fetchDN($this->selectUsername($credentials->getUsername())),
$credentials->getPassword()
) ) {
)
) {
return false;
}
$user = new User($credentials->getUsername());
Expand Down

0 comments on commit 72bb02d

Please sign in to comment.