Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 31 deletions.
1 change: 0 additions & 1 deletion src/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

abstract class AbstractAdapter implements ValidatableAdapterInterface
{

/**
* @var mixed
*/
Expand Down
5 changes: 0 additions & 5 deletions src/Adapter/DbTable/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,25 +195,21 @@ public function getResultRowObject($returnColumns = null, $omitColumns = null)
$returnObject = new stdClass();

if (null !== $returnColumns) {

$availableColumns = array_keys($this->resultRow);
foreach ((array) $returnColumns as $returnColumn) {
if (in_array($returnColumn, $availableColumns)) {
$returnObject->{$returnColumn} = $this->resultRow[$returnColumn];
}
}
return $returnObject;

} elseif (null !== $omitColumns) {

$omitColumns = (array) $omitColumns;
foreach ($this->resultRow as $resultColumn => $resultValue) {
if (!in_array($resultColumn, $omitColumns)) {
$returnObject->{$resultColumn} = $resultValue;
}
}
return $returnObject;

}

foreach ($this->resultRow as $resultColumn => $resultValue) {
Expand Down Expand Up @@ -352,7 +348,6 @@ protected function authenticateQuerySelect(Sql\Select $dbSelect)
*/
protected function authenticateValidateResultSet(array $resultIdentities)
{

if (count($resultIdentities) < 1) {
$this->authenticateResultInfo['code'] = AuthenticationResult::FAILURE_IDENTITY_NOT_FOUND;
$this->authenticateResultInfo['messages'][] = 'A record with the supplied identity could not be found.';
Expand Down
11 changes: 4 additions & 7 deletions src/Adapter/Digest.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,14 @@ public function authenticate()
}
if (substr($line, 0, $idLength) === $id) {
if (CryptUtils::compareStrings(substr($line, -32), md5("$this->identity:$this->realm:$this->credential"))) {
$result['code'] = AuthenticationResult::SUCCESS;
} else {
$result['code'] = AuthenticationResult::FAILURE_CREDENTIAL_INVALID;
$result['messages'][] = 'Password incorrect';
return new AuthenticationResult(AuthenticationResult::SUCCESS, $result['identity'], $result['messages']);
}
return new AuthenticationResult($result['code'], $result['identity'], $result['messages']);
$result['messages'][] = 'Password incorrect';
return new AuthenticationResult(AuthenticationResult::FAILURE_CREDENTIAL_INVALID, $result['identity'], $result['messages']);
}
}

$result['code'] = AuthenticationResult::FAILURE_IDENTITY_NOT_FOUND;
$result['messages'][] = "Username '$this->identity' and realm '$this->realm' combination not found";
return new AuthenticationResult($result['code'], $result['identity'], $result['messages']);
return new AuthenticationResult(AuthenticationResult::FAILURE_IDENTITY_NOT_FOUND, $result['identity'], $result['messages']);
}
}
1 change: 0 additions & 1 deletion src/Adapter/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,6 @@ protected function _parseDigestAuth($header)
if ($this->useOpaque) {
$ret = preg_match('/opaque="([^"]+)"/', $header, $temp);
if (!$ret || empty($temp[1])) {

// Big surprise: IE isn't RFC 2617-compliant.
$headers = $this->request->getHeaders();
if (!$headers->has('User-Agent')) {
Expand Down
3 changes: 0 additions & 3 deletions src/Adapter/Ldap.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

class Ldap extends AbstractAdapter
{

/**
* The Zend\Ldap\Ldap context.
*
Expand Down Expand Up @@ -214,7 +213,6 @@ public function authenticate()
* credentials against it.
*/
foreach ($this->options as $options) {

if (!is_array($options)) {
throw new Exception\InvalidArgumentException('Adapter options array not an array');
}
Expand Down Expand Up @@ -277,7 +275,6 @@ public function authenticate()
$failedAuthorities[$dname] = $groupResult;
}
} catch (LdapException $zle) {

/* LDAP based authentication is notoriously difficult to diagnose. Therefore
* we bend over backwards to capture and record every possible bit of
* information when something goes wrong.
Expand Down
1 change: 0 additions & 1 deletion test/Adapter/DbTable/CallbackCheckAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,5 +377,4 @@ protected function _setupAuthAdapter()
{
$this->_adapter = new Adapter\DbTable\CallbackCheckAdapter($this->_db, 'users', 'username', 'password');
}

}
1 change: 0 additions & 1 deletion test/Adapter/DbTable/CredentialTreatmentAdapterDb2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
class CredentialTreatmentAdapterDb2Test extends \PHPUnit_Framework_TestCase
{

/**
* IbmDb2 database connection
*
Expand Down
1 change: 0 additions & 1 deletion test/Adapter/DbTable/CredentialTreatmentAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,5 +364,4 @@ protected function _setupAuthAdapter()
{
$this->_adapter = new Adapter\DbTable\CredentialTreatmentAdapter($this->_db, 'users', 'username', 'password');
}

}
2 changes: 0 additions & 2 deletions test/Adapter/DbTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
*/
class DbTableTest extends DbTable\CredentialTreatmentAdapterTest
{

protected function _setupAuthAdapter()
{
$this->_adapter = new Adapter\DbTable($this->_db, 'users', 'username', 'password');
}

}
5 changes: 3 additions & 2 deletions test/Adapter/Http/ObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ public function testValidConfigs()
$this->_digestConfig,
$this->_bothConfig,
);
foreach ($configs as $config)
new Adapter\Http($config);
foreach ($configs as $config) {
new Adapter\Http($config);
}
}

public function testInvalidConfigs()
Expand Down
21 changes: 14 additions & 7 deletions test/Adapter/Ldap/OnlineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,27 @@ public function setUp()
'password' => TESTS_ZEND_LDAP_PASSWORD,
'baseDn' => TESTS_ZEND_LDAP_BASE_DN,
);
if (defined('TESTS_ZEND_LDAP_PORT'))
if (defined('TESTS_ZEND_LDAP_PORT')) {
$this->options['port'] = TESTS_ZEND_LDAP_PORT;
if (defined('TESTS_ZEND_LDAP_USE_START_TLS'))
}
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;
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;
if (defined('TESTS_ZEND_LDAP_ACCOUNT_FILTER_FORMAT'))
}
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;
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;
}

if (defined('TESTS_ZEND_LDAP_ALT_USERNAME')) {
$this->names[Ldap\Ldap::ACCTNAME_FORM_USERNAME] = TESTS_ZEND_LDAP_ALT_USERNAME;
Expand Down

0 comments on commit ad506d6

Please sign in to comment.