Module administration
Rebase fix ldap auth for testing issue. refs #4092
This commit is contained in:
parent
d1f4e9831a
commit
72bb02d390
|
@ -8,6 +8,7 @@ use Icinga\Authentication\User as User;
|
||||||
use Icinga\Authentication\UserBackend;
|
use Icinga\Authentication\UserBackend;
|
||||||
use Icinga\Authentication\Credentials;
|
use Icinga\Authentication\Credentials;
|
||||||
use Icinga\Protocol\Ldap;
|
use Icinga\Protocol\Ldap;
|
||||||
|
use Icinga\Application\Config;
|
||||||
|
|
||||||
class LdapUserBackend implements UserBackend
|
class LdapUserBackend implements UserBackend
|
||||||
{
|
{
|
||||||
|
@ -33,8 +34,16 @@ class LdapUserBackend implements UserBackend
|
||||||
protected function selectUsername($username)
|
protected function selectUsername($username)
|
||||||
{
|
{
|
||||||
return $this->connection->select()
|
return $this->connection->select()
|
||||||
->from('user', array('sAMAccountName'))
|
->from(
|
||||||
->where('sAMAccountName', $this->stripAsterisks($username));
|
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)
|
public function authenticate(Credentials $credentials)
|
||||||
|
@ -42,7 +51,8 @@ class LdapUserBackend implements UserBackend
|
||||||
if (!$this->connection->testCredentials(
|
if (!$this->connection->testCredentials(
|
||||||
$this->connection->fetchDN($this->selectUsername($credentials->getUsername())),
|
$this->connection->fetchDN($this->selectUsername($credentials->getUsername())),
|
||||||
$credentials->getPassword()
|
$credentials->getPassword()
|
||||||
) ) {
|
)
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$user = new User($credentials->getUsername());
|
$user = new User($credentials->getUsername());
|
||||||
|
|
Loading…
Reference in New Issue