diff --git a/src/Adapter/AbstractAdapter.php b/src/Adapter/AbstractAdapter.php index e57910d..2f394f9 100644 --- a/src/Adapter/AbstractAdapter.php +++ b/src/Adapter/AbstractAdapter.php @@ -11,7 +11,6 @@ abstract class AbstractAdapter implements ValidatableAdapterInterface { - /** * @var mixed */ diff --git a/src/Adapter/DbTable/AbstractAdapter.php b/src/Adapter/DbTable/AbstractAdapter.php index 6e8bba8..612c0fe 100644 --- a/src/Adapter/DbTable/AbstractAdapter.php +++ b/src/Adapter/DbTable/AbstractAdapter.php @@ -195,7 +195,6 @@ 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)) { @@ -203,9 +202,7 @@ public function getResultRowObject($returnColumns = null, $omitColumns = null) } } return $returnObject; - } elseif (null !== $omitColumns) { - $omitColumns = (array) $omitColumns; foreach ($this->resultRow as $resultColumn => $resultValue) { if (!in_array($resultColumn, $omitColumns)) { @@ -213,7 +210,6 @@ public function getResultRowObject($returnColumns = null, $omitColumns = null) } } return $returnObject; - } foreach ($this->resultRow as $resultColumn => $resultValue) { @@ -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.'; diff --git a/src/Adapter/Digest.php b/src/Adapter/Digest.php index 5c3c838..0ddb901 100644 --- a/src/Adapter/Digest.php +++ b/src/Adapter/Digest.php @@ -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']); } } diff --git a/src/Adapter/Http.php b/src/Adapter/Http.php index bde60a2..bc14519 100644 --- a/src/Adapter/Http.php +++ b/src/Adapter/Http.php @@ -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')) { diff --git a/src/Adapter/Ldap.php b/src/Adapter/Ldap.php index 2b17e33..d9384c5 100644 --- a/src/Adapter/Ldap.php +++ b/src/Adapter/Ldap.php @@ -16,7 +16,6 @@ class Ldap extends AbstractAdapter { - /** * The Zend\Ldap\Ldap context. * @@ -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'); } @@ -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. diff --git a/test/Adapter/DbTable/CallbackCheckAdapterTest.php b/test/Adapter/DbTable/CallbackCheckAdapterTest.php index d23c3a7..758dbfc 100644 --- a/test/Adapter/DbTable/CallbackCheckAdapterTest.php +++ b/test/Adapter/DbTable/CallbackCheckAdapterTest.php @@ -377,5 +377,4 @@ protected function _setupAuthAdapter() { $this->_adapter = new Adapter\DbTable\CallbackCheckAdapter($this->_db, 'users', 'username', 'password'); } - } diff --git a/test/Adapter/DbTable/CredentialTreatmentAdapterDb2Test.php b/test/Adapter/DbTable/CredentialTreatmentAdapterDb2Test.php index db78a88..904fe04 100644 --- a/test/Adapter/DbTable/CredentialTreatmentAdapterDb2Test.php +++ b/test/Adapter/DbTable/CredentialTreatmentAdapterDb2Test.php @@ -19,7 +19,6 @@ */ class CredentialTreatmentAdapterDb2Test extends \PHPUnit_Framework_TestCase { - /** * IbmDb2 database connection * diff --git a/test/Adapter/DbTable/CredentialTreatmentAdapterTest.php b/test/Adapter/DbTable/CredentialTreatmentAdapterTest.php index 8efab92..e61289a 100644 --- a/test/Adapter/DbTable/CredentialTreatmentAdapterTest.php +++ b/test/Adapter/DbTable/CredentialTreatmentAdapterTest.php @@ -364,5 +364,4 @@ protected function _setupAuthAdapter() { $this->_adapter = new Adapter\DbTable\CredentialTreatmentAdapter($this->_db, 'users', 'username', 'password'); } - } diff --git a/test/Adapter/DbTableTest.php b/test/Adapter/DbTableTest.php index 44154ef..1c56a22 100644 --- a/test/Adapter/DbTableTest.php +++ b/test/Adapter/DbTableTest.php @@ -17,10 +17,8 @@ */ class DbTableTest extends DbTable\CredentialTreatmentAdapterTest { - protected function _setupAuthAdapter() { $this->_adapter = new Adapter\DbTable($this->_db, 'users', 'username', 'password'); } - } diff --git a/test/Adapter/Http/ObjectTest.php b/test/Adapter/Http/ObjectTest.php index 0cb7082..55888ed 100644 --- a/test/Adapter/Http/ObjectTest.php +++ b/test/Adapter/Http/ObjectTest.php @@ -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() diff --git a/test/Adapter/Ldap/OnlineTest.php b/test/Adapter/Ldap/OnlineTest.php index e7ef40c..6a6300b 100644 --- a/test/Adapter/Ldap/OnlineTest.php +++ b/test/Adapter/Ldap/OnlineTest.php @@ -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;