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

Commit

Permalink
Merge remote-tracking branch 'zf2/master' into feature/mail
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 13 changed files with 144 additions and 155 deletions.
74 changes: 37 additions & 37 deletions src/Adapter/DbTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
*/

namespace Zend\Authentication\Adapter;
use Zend\Authentication\Adapter\AdapterInterface as AuthenticationAdapter,
Zend\Authentication\Result as AuthenticationResult,

use Zend\Authentication\Result as AuthenticationResult,
Zend\Db\Adapter\Adapter as DbAdapter,
Zend\Db\Sql\Select as DbSelect,
Zend\Db\Sql\Expression,
Expand All @@ -34,7 +34,7 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class DbTable implements AuthenticationAdapter
class DbTable implements AdapterInterface
{

/**
Expand Down Expand Up @@ -117,12 +117,12 @@ class DbTable implements AuthenticationAdapter
/**
* __construct() - Sets configuration options
*
* @param DbAdapter $zendDb
* @param string $tableName
* @param string $identityColumn
* @param string $credentialColumn
* @param string $credentialTreatment
* @return void
* @param DbAdapter $zendDb
* @param string $tableName Optional
* @param string $identityColumn Optional
* @param string $credentialColumn Optional
* @param string $credentialTreatment Optional
* @return \Zend\Authentication\Adapter\DbTable
*/
public function __construct(DbAdapter $zendDb, $tableName = null, $identityColumn = null,
$credentialColumn = null, $credentialTreatment = null)
Expand Down Expand Up @@ -183,12 +183,12 @@ public function setCredentialColumn($credentialColumn)
}

/**
* setCredentialTreatment() - allows the developer to pass a parameterized string that is
* setCredentialTreatment() - allows the developer to pass a parametrized string that is
* used to transform or treat the input credential data.
*
* In many cases, passwords and other sensitive data are encrypted, hashed, encoded,
* obscured, or otherwise treated through some function or algorithm. By specifying a
* parameterized treatment string with this method, a developer may apply arbitrary SQL
* parametrized treatment string with this method, a developer may apply arbitrary SQL
* upon input credential data.
*
* Examples:
Expand Down Expand Up @@ -219,7 +219,7 @@ public function setIdentity($value)

/**
* setCredential() - set the credential value to be used, optionally can specify a treatment
* to be used, should be supplied in parameterized form, such as 'MD5(?)' or 'PASSWORD(?)'
* to be used, should be supplied in parametrized form, such as 'MD5(?)' or 'PASSWORD(?)'
*
* @param string $credential
* @return DbTable Provides a fluent interface
Expand Down Expand Up @@ -250,7 +250,7 @@ public function setAmbiguityIdentity($flag)

/**
* getAmbiguityIdentity() - returns TRUE for usage of multiple identical
* identies with different credentials, FALSE if not used.
* identities with different credentials, FALSE if not used.
*
* @return bool
*/
Expand Down Expand Up @@ -290,7 +290,7 @@ public function getResultRowObject($returnColumns = null, $omitColumns = null)
if (null !== $returnColumns) {

$availableColumns = array_keys($this->_resultRow);
foreach ( (array) $returnColumns as $returnColumn) {
foreach ((array)$returnColumns as $returnColumn) {
if (in_array($returnColumn, $availableColumns)) {
$returnObject->{$returnColumn} = $this->_resultRow[$returnColumn];
}
Expand All @@ -299,7 +299,7 @@ public function getResultRowObject($returnColumns = null, $omitColumns = null)

} elseif (null !== $omitColumns) {

$omitColumns = (array) $omitColumns;
$omitColumns = (array)$omitColumns;
foreach ($this->_resultRow as $resultColumn => $resultValue) {
if (!in_array($resultColumn, $omitColumns)) {
$returnObject->{$resultColumn} = $resultValue;
Expand All @@ -318,21 +318,21 @@ public function getResultRowObject($returnColumns = null, $omitColumns = null)
}

/**
* authenticate() - defined by Zend_Auth_Adapter_Interface. This method is called to
* attempt an authentication. Previous to this call, this adapter would have already
* been configured with all necessary information to successfully connect to a database
* table and attempt to find a record matching the provided identity.
* This method is called to attempt an authentication. Previous to this
* call, this adapter would have already been configured with all
* necessary information to successfully connect to a database table and
* attempt to find a record matching the provided identity.
*
* @throws Exception if answering the authentication query is impossible
* @throws Exception\RuntimeException if answering the authentication query is impossible
* @return AuthenticationResult
*/
public function authenticate()
{
$this->_authenticateSetup();
$dbSelect = $this->_authenticateCreateSelect();
$dbSelect = $this->_authenticateCreateSelect();
$resultIdentities = $this->_authenticateQuerySelect($dbSelect);

if ( ($authResult = $this->_authenticateValidateResultSet($resultIdentities)) instanceof AuthenticationResult) {
if (($authResult = $this->_authenticateValidateResultSet($resultIdentities)) instanceof AuthenticationResult) {
return $authResult;
}

Expand All @@ -352,8 +352,8 @@ public function authenticate()
* making sure that this adapter was indeed setup properly with all
* required pieces of information.
*
* @throws Exception\ExceptionInterface - in the event that setup was not done properly
* @return true
* @throws Exception\RuntimeException in the event that setup was not done properly
* @return boolean
*/
protected function _authenticateSetup()
{
Expand All @@ -379,7 +379,7 @@ protected function _authenticateSetup()
'code' => AuthenticationResult::FAILURE,
'identity' => $this->_identity,
'messages' => array()
);
);

return true;
}
Expand Down Expand Up @@ -419,10 +419,10 @@ protected function _authenticateCreateSelect()
* performs a query against the database with that object.
*
* @param DbSelect $dbSelect
* @throws Exception - when an invalid select object is encountered
* @throws Exception\RuntimeException when an invalid select object is encountered
* @return array
*/
protected function _authenticateQuerySelect(DBSelect $dbSelect)
protected function _authenticateQuerySelect(DbSelect $dbSelect)
{
$statement = $this->_zendDb->createStatement();
$dbSelect->prepareStatement($this->_zendDb, $statement);
Expand All @@ -433,8 +433,8 @@ protected function _authenticateQuerySelect(DBSelect $dbSelect)
} catch (\Exception $e) {
throw new Exception\RuntimeException(
'The supplied parameters to DbTable failed to '
. 'produce a valid sql statement, please check table and column names '
. 'for validity.', 0, $e
. 'produce a valid sql statement, please check table and column names '
. 'for validity.', 0, $e
);
}
return $resultIdentities;
Expand All @@ -444,18 +444,18 @@ protected function _authenticateQuerySelect(DBSelect $dbSelect)
* _authenticateValidateResultSet() - This method attempts to make
* certain that only one record was returned in the resultset
*
* @param array $resultIdentities
* @return true|Zend\Authentication\Result
* @param array $resultIdentities
* @return boolean|\Zend\Authentication\Result
*/
protected function _authenticateValidateResultSet(array $resultIdentities)
{

if (count($resultIdentities) < 1) {
$this->_authenticateResultInfo['code'] = AuthenticationResult::FAILURE_IDENTITY_NOT_FOUND;
$this->_authenticateResultInfo['code'] = AuthenticationResult::FAILURE_IDENTITY_NOT_FOUND;
$this->_authenticateResultInfo['messages'][] = 'A record with the supplied identity could not be found.';
return $this->_authenticateCreateAuthResult();
} elseif (count($resultIdentities) > 1 && false === $this->getAmbiguityIdentity()) {
$this->_authenticateResultInfo['code'] = AuthenticationResult::FAILURE_IDENTITY_AMBIGUOUS;
$this->_authenticateResultInfo['code'] = AuthenticationResult::FAILURE_IDENTITY_AMBIGUOUS;
$this->_authenticateResultInfo['messages'][] = 'More than one record matches the supplied identity.';
return $this->_authenticateCreateAuthResult();
}
Expand All @@ -474,22 +474,22 @@ protected function _authenticateValidateResultSet(array $resultIdentities)
protected function _authenticateValidateResult($resultIdentity)
{
if ($resultIdentity['zend_auth_credential_match'] != '1') {
$this->_authenticateResultInfo['code'] = AuthenticationResult::FAILURE_CREDENTIAL_INVALID;
$this->_authenticateResultInfo['code'] = AuthenticationResult::FAILURE_CREDENTIAL_INVALID;
$this->_authenticateResultInfo['messages'][] = 'Supplied credential is invalid.';
return $this->_authenticateCreateAuthResult();
}

unset($resultIdentity['zend_auth_credential_match']);
$this->_resultRow = $resultIdentity;

$this->_authenticateResultInfo['code'] = AuthenticationResult::SUCCESS;
$this->_authenticateResultInfo['code'] = AuthenticationResult::SUCCESS;
$this->_authenticateResultInfo['messages'][] = 'Authentication successful.';
return $this->_authenticateCreateAuthResult();
}

/**
* _authenticateCreateAuthResult() - Creates a Zend_Auth_Result object from
* the information that has been collected during the authenticate() attempt.
* Creates a Zend\Authentication\Result object from the information that
* has been collected during the authenticate() attempt.
*
* @return AuthenticationResult
*/
Expand Down
8 changes: 4 additions & 4 deletions src/Adapter/Digest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
*/

namespace Zend\Authentication\Adapter;
use Zend\Authentication\Adapter\AdapterInterface as AuthenticationAdapter,
Zend\Authentication\Result as AuthenticationResult;

use Zend\Authentication\Result as AuthenticationResult;

/**
* @category Zend
Expand All @@ -30,7 +30,7 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Digest implements AuthenticationAdapter
class Digest implements AdapterInterface
{
/**
* Filename against which authentication queries are performed
Expand Down Expand Up @@ -169,7 +169,7 @@ public function setPassword($password)
}

/**
* Defined by Zend_Auth_Adapter_Interface
* Defined by Zend\Authentication\Adapter\AdapterInterface
*
* @throws Zend\Authentication\Adapter\Exception\ExceptionInterface
* @return Zend\Authentication\Result
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

class InvalidArgumentException
extends \InvalidArgumentException
implements \Zend\Authentication\Adapter\Exception\ExceptionInterface
implements ExceptionInterface
{
}
2 changes: 1 addition & 1 deletion src/Adapter/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class RuntimeException
extends \RuntimeException
implements \Zend\Authentication\Adapter\Exception\ExceptionInterface
implements ExceptionInterface
{

}
2 changes: 1 addition & 1 deletion src/Adapter/Exception/UnexpectedValueException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

class UnexpectedValueException
extends \UnexpectedValueException
implements \Zend\Authentication\Adapter\Exception\ExceptionInterface
implements ExceptionInterface
{
}
5 changes: 2 additions & 3 deletions src/Adapter/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

namespace Zend\Authentication\Adapter;

use Zend\Authentication\Adapter\AdapterInterface as AuthenticationAdapter,
Zend\Authentication,
use Zend\Authentication,
Zend\Http\Request as HTTPRequest,
Zend\Http\Response as HTTPResponse,
Zend\Uri\UriFactory;
Expand All @@ -41,7 +40,7 @@
* @todo Track nonces, nonce-count, opaque for replay protection and stale support
* @todo Support Authentication-Info header
*/
class Http implements AuthenticationAdapter
class Http implements AdapterInterface
{
/**
* Reference to the HTTP Request object
Expand Down
Loading

0 comments on commit 70e2a6d

Please # to comment.