aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/security
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-06-25 16:53:18 +0200
committerGitHub <noreply@github.com>2020-06-25 16:53:18 +0200
commit78c2f122e067f8bab62deb7ef758708721f4a9ba (patch)
tree521baacd42ca547c13bf22549cd0a9025af0c371 /tests/security
parente1231265bc46b070a4edd573c417aa030fe83426 (diff)
parent8694e8411b19d499ff58d8168fba448c63a5e443 (diff)
downloadShaarli-78c2f122e067f8bab62deb7ef758708721f4a9ba.tar.gz
Shaarli-78c2f122e067f8bab62deb7ef758708721f4a9ba.tar.zst
Shaarli-78c2f122e067f8bab62deb7ef758708721f4a9ba.zip
Merge pull request #1428 from pipoprods/feat/ldap-auth
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..8fd1698c 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->configManager->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}