ldap authentication, fixes shaarli/Shaarli#1343
This commit is contained in:
parent
810f0f6c96
commit
cc2ded54e1
3 changed files with 102 additions and 13 deletions
tests/security
|
@ -78,6 +78,7 @@ class LoginManagerTest extends TestCase
|
|||
'security.ban_after' => 2,
|
||||
'security.ban_duration' => 3600,
|
||||
'security.trusted_proxies' => [$this->trustedProxy],
|
||||
'ldap.host' => '',
|
||||
]);
|
||||
|
||||
$this->cookie = [];
|
||||
|
@ -296,4 +297,37 @@ class LoginManagerTest extends TestCase
|
|||
$this->loginManager->checkCredentials('', '', $this->login, $this->password)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check user credentials through LDAP - server unreachable
|
||||
*/
|
||||
public function testCheckCredentialsFromUnreachableLdap()
|
||||
{
|
||||
$this->configManager->set('ldap.host', 'dummy');
|
||||
$this->assertFalse(
|
||||
$this->loginManager->checkCredentials('', '', $this->login, $this->password)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check user credentials through LDAP - wrong login and password supplied
|
||||
*/
|
||||
public function testCheckCredentialsFromLdapWrongLoginAndPassword()
|
||||
{
|
||||
$this->coddnfigManager->set('ldap.host', 'dummy');
|
||||
$this->assertFalse(
|
||||
$this->loginManager->checkCredentialsFromLdap($this->login, $this->password, function() { return null; }, function() { return false; })
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check user credentials through LDAP - correct login and password supplied
|
||||
*/
|
||||
public function testCheckCredentialsFromLdapGoodLoginAndPassword()
|
||||
{
|
||||
$this->configManager->set('ldap.host', 'dummy');
|
||||
$this->assertTrue(
|
||||
$this->loginManager->checkCredentialsFromLdap($this->login, $this->password, function() { return null; }, function() { return true; })
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue