aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/security
diff options
context:
space:
mode:
Diffstat (limited to 'tests/security')
-rw-r--r--tests/security/LoginManagerTest.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/security/LoginManagerTest.php b/tests/security/LoginManagerTest.php
index eef0f22a..f2d78802 100644
--- a/tests/security/LoginManagerTest.php
+++ b/tests/security/LoginManagerTest.php
@@ -78,6 +78,7 @@ class LoginManagerTest extends TestCase
78 'security.ban_after' => 2, 78 'security.ban_after' => 2,
79 'security.ban_duration' => 3600, 79 'security.ban_duration' => 3600,
80 'security.trusted_proxies' => [$this->trustedProxy], 80 'security.trusted_proxies' => [$this->trustedProxy],
81 'ldap.host' => '',
81 ]); 82 ]);
82 83
83 $this->cookie = []; 84 $this->cookie = [];
@@ -296,4 +297,37 @@ class LoginManagerTest extends TestCase
296 $this->loginManager->checkCredentials('', '', $this->login, $this->password) 297 $this->loginManager->checkCredentials('', '', $this->login, $this->password)
297 ); 298 );
298 } 299 }
300
301 /**
302 * Check user credentials through LDAP - server unreachable
303 */
304 public function testCheckCredentialsFromUnreachableLdap()
305 {
306 $this->configManager->set('ldap.host', 'dummy');
307 $this->assertFalse(
308 $this->loginManager->checkCredentials('', '', $this->login, $this->password)
309 );
310 }
311
312 /**
313 * Check user credentials through LDAP - wrong login and password supplied
314 */
315 public function testCheckCredentialsFromLdapWrongLoginAndPassword()
316 {
317 $this->coddnfigManager->set('ldap.host', 'dummy');
318 $this->assertFalse(
319 $this->loginManager->checkCredentialsFromLdap($this->login, $this->password, function() { return null; }, function() { return false; })
320 );
321 }
322
323 /**
324 * Check user credentials through LDAP - correct login and password supplied
325 */
326 public function testCheckCredentialsFromLdapGoodLoginAndPassword()
327 {
328 $this->configManager->set('ldap.host', 'dummy');
329 $this->assertTrue(
330 $this->loginManager->checkCredentialsFromLdap($this->login, $this->password, function() { return null; }, function() { return true; })
331 );
332 }
299} 333}