|
@@ -64,16 +64,21 @@ class Zend_Auth_Adapter_Ldap_OnlineTest extends PHPUnit_Framework_TestCase
|
|
|
'password' => TESTS_ZEND_LDAP_PASSWORD,
|
|
'password' => TESTS_ZEND_LDAP_PASSWORD,
|
|
|
'baseDn' => TESTS_ZEND_LDAP_BASE_DN,
|
|
'baseDn' => TESTS_ZEND_LDAP_BASE_DN,
|
|
|
);
|
|
);
|
|
|
- if (defined('TESTS_ZEND_LDAP_PORT') && TESTS_ZEND_LDAP_PORT != 389)
|
|
|
|
|
|
|
+ if (defined('TESTS_ZEND_LDAP_PORT'))
|
|
|
$this->_options['port'] = TESTS_ZEND_LDAP_PORT;
|
|
$this->_options['port'] = TESTS_ZEND_LDAP_PORT;
|
|
|
|
|
+ if (defined('TESTS_ZEND_LDAP_USE_START_TLS'))
|
|
|
|
|
+ $this->_options['useStartTls'] = TESTS_ZEND_LDAP_USE_START_TLS;
|
|
|
if (defined('TESTS_ZEND_LDAP_USE_SSL'))
|
|
if (defined('TESTS_ZEND_LDAP_USE_SSL'))
|
|
|
$this->_options['useSsl'] = TESTS_ZEND_LDAP_USE_SSL;
|
|
$this->_options['useSsl'] = TESTS_ZEND_LDAP_USE_SSL;
|
|
|
if (defined('TESTS_ZEND_LDAP_BIND_REQUIRES_DN'))
|
|
if (defined('TESTS_ZEND_LDAP_BIND_REQUIRES_DN'))
|
|
|
$this->_options['bindRequiresDn'] = TESTS_ZEND_LDAP_BIND_REQUIRES_DN;
|
|
$this->_options['bindRequiresDn'] = TESTS_ZEND_LDAP_BIND_REQUIRES_DN;
|
|
|
|
|
+ if (defined('TESTS_ZEND_LDAP_ACCOUNT_FILTER_FORMAT'))
|
|
|
|
|
+ $this->_options['accountFilterFormat'] = TESTS_ZEND_LDAP_ACCOUNT_FILTER_FORMAT;
|
|
|
if (defined('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME'))
|
|
if (defined('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME'))
|
|
|
$this->_options['accountDomainName'] = TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME;
|
|
$this->_options['accountDomainName'] = TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME;
|
|
|
if (defined('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT'))
|
|
if (defined('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT'))
|
|
|
$this->_options['accountDomainNameShort'] = TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT;
|
|
$this->_options['accountDomainNameShort'] = TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT;
|
|
|
|
|
+
|
|
|
if (defined('TESTS_ZEND_LDAP_ALT_USERNAME')) {
|
|
if (defined('TESTS_ZEND_LDAP_ALT_USERNAME')) {
|
|
|
$this->_names[Zend_Ldap::ACCTNAME_FORM_USERNAME] = TESTS_ZEND_LDAP_ALT_USERNAME;
|
|
$this->_names[Zend_Ldap::ACCTNAME_FORM_USERNAME] = TESTS_ZEND_LDAP_ALT_USERNAME;
|
|
|
if (defined('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME')) {
|
|
if (defined('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME')) {
|
|
@@ -96,6 +101,7 @@ class Zend_Auth_Adapter_Ldap_OnlineTest extends PHPUnit_Framework_TestCase
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
$result = $adapter->authenticate();
|
|
$result = $adapter->authenticate();
|
|
|
|
|
+
|
|
|
$this->assertTrue($result instanceof Zend_Auth_Result);
|
|
$this->assertTrue($result instanceof Zend_Auth_Result);
|
|
|
$this->assertTrue($result->isValid());
|
|
$this->assertTrue($result->isValid());
|
|
|
$this->assertTrue($result->getCode() == Zend_Auth_Result::SUCCESS);
|
|
$this->assertTrue($result->getCode() == Zend_Auth_Result::SUCCESS);
|
|
@@ -171,4 +177,20 @@ class Zend_Auth_Adapter_Ldap_OnlineTest extends PHPUnit_Framework_TestCase
|
|
|
$messages = $result->getMessages();
|
|
$messages = $result->getMessages();
|
|
|
$this->assertContains('not found', $messages[0]);
|
|
$this->assertContains('not found', $messages[0]);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public function testAccountObjectRetrieval()
|
|
|
|
|
+ {
|
|
|
|
|
+ $adapter = new Zend_Auth_Adapter_Ldap(
|
|
|
|
|
+ array($this->_options),
|
|
|
|
|
+ TESTS_ZEND_LDAP_ALT_USERNAME,
|
|
|
|
|
+ TESTS_ZEND_LDAP_ALT_PASSWORD
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ $result = $adapter->authenticate();
|
|
|
|
|
+ $account = $adapter->getAccountObject();
|
|
|
|
|
+
|
|
|
|
|
+ $this->assertTrue($result->isValid());
|
|
|
|
|
+ $this->assertType('stdClass', $account);
|
|
|
|
|
+ $this->assertEquals(TESTS_ZEND_LDAP_ALT_DN, $account->dn);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|