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

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
Promote develop to master, becoming the next stable release.
  • Loading branch information
Show file tree
Hide file tree
Showing 22 changed files with 147 additions and 34 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
},
"require": {
"php": ">=5.3.3",
"php": ">=5.3.23",
"zendframework/zend-stdlib": "self.version"
},
"require-dev": {
Expand Down
41 changes: 29 additions & 12 deletions src/Adapter/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,11 @@ public function authenticate()

$headers = $this->request->getHeaders();
if (!$headers->has($getHeader)) {
return $this->_challengeClient();
return $this->challengeClient();
}
$authHeader = $headers->get($getHeader)->getFieldValue();
if (!$authHeader) {
return $this->_challengeClient();
return $this->challengeClient();
}

list($clientScheme) = explode(' ', $authHeader);
Expand All @@ -360,7 +360,7 @@ public function authenticate()
// client sent a scheme that is not the one required
if (!in_array($clientScheme, $this->acceptSchemes)) {
// challenge again the client
return $this->_challengeClient();
return $this->challengeClient();
}

switch ($clientScheme) {
Expand All @@ -377,6 +377,23 @@ public function authenticate()
return $result;
}

/**
* @deprecated
* @see Http::challengeClient()
* @return Authentication\Result Always returns a non-identity Auth result
*/
protected function _challengeClient()
{
trigger_error(sprintf(
'The method "%s" is deprecated and will be removed in the future; '
. 'please use the public method "%s::challengeClient()" instead',
__METHOD__,
__CLASS__
), E_USER_DEPRECATED);

return $this->challengeClient();
}

/**
* Challenge Client
*
Expand All @@ -385,7 +402,7 @@ public function authenticate()
*
* @return Authentication\Result Always returns a non-identity Auth result
*/
protected function _challengeClient()
public function challengeClient()
{
if ($this->imaProxy) {
$statusCode = 407;
Expand Down Expand Up @@ -474,12 +491,12 @@ protected function _basicAuth($header)
// implementation does. If invalid credentials are detected,
// re-challenge the client.
if (!ctype_print($auth)) {
return $this->_challengeClient();
return $this->challengeClient();
}
// Fix for ZF-1515: Now re-challenges on empty username or password
$creds = array_filter(explode(':', $auth));
if (count($creds) != 2) {
return $this->_challengeClient();
return $this->challengeClient();
}

$result = $this->basicResolver->resolve($creds[0], $this->realm, $creds[1]);
Expand All @@ -498,7 +515,7 @@ protected function _basicAuth($header)
return new Authentication\Result(Authentication\Result::SUCCESS, $result);
}

return $this->_challengeClient();
return $this->challengeClient();
}

/**
Expand Down Expand Up @@ -530,17 +547,17 @@ protected function _digestAuth($header)
// See ZF-1052. This code was a bit too unforgiving of invalid
// usernames. Now, if the username is bad, we re-challenge the client.
if ('::invalid::' == $data['username']) {
return $this->_challengeClient();
return $this->challengeClient();
}

// Verify that the client sent back the same nonce
if ($this->_calcNonce() != $data['nonce']) {
return $this->_challengeClient();
return $this->challengeClient();
}
// The opaque value is also required to match, but of course IE doesn't
// play ball.
if (!$this->ieNoOpaque && $this->_calcOpaque() != $data['opaque']) {
return $this->_challengeClient();
return $this->challengeClient();
}

// Look up the user's password hash. If not found, deny access.
Expand All @@ -549,7 +566,7 @@ protected function _digestAuth($header)
// to be recreatable with the current settings of this object.
$ha1 = $this->digestResolver->resolve($data['username'], $data['realm']);
if ($ha1 === false) {
return $this->_challengeClient();
return $this->challengeClient();
}

// If MD5-sess is used, a1 value is made of the user's password
Expand Down Expand Up @@ -588,7 +605,7 @@ protected function _digestAuth($header)
return new Authentication\Result(Authentication\Result::SUCCESS, $identity);
}

return $this->_challengeClient();
return $this->challengeClient();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/AuthenticationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Zend\Authentication;

class AuthenticationService
class AuthenticationService implements AuthenticationServiceInterface
{
/**
* Persistent storage handler
Expand Down
44 changes: 44 additions & 0 deletions src/AuthenticationServiceInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\Authentication;

/**
* Provides an API for authentication and identity management
*/
interface AuthenticationServiceInterface
{
/**
* Authenticates and provides an authentication result
*
* @return Result
*/
public function authenticate();

/**
* Returns true if and only if an identity is available
*
* @return bool
*/
public function hasIdentity();

/**
* Returns the authenticated identity or null if no identity is available
*
* @return mixed|null
*/
public function getIdentity();

/**
* Clears the identity
*
* @return void
*/
public function clearIdentity();
}
2 changes: 1 addition & 1 deletion test/Adapter/DbTable/CallbackCheckAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
2 changes: 1 addition & 1 deletion test/Adapter/DbTable/CredentialTreatmentAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
2 changes: 1 addition & 1 deletion test/Adapter/DbTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
2 changes: 1 addition & 1 deletion test/Adapter/DigestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
2 changes: 1 addition & 1 deletion test/Adapter/Http/ApacheResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
2 changes: 1 addition & 1 deletion test/Adapter/Http/AuthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
2 changes: 1 addition & 1 deletion test/Adapter/Http/FileResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
2 changes: 1 addition & 1 deletion test/Adapter/Http/ObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
8 changes: 4 additions & 4 deletions test/Adapter/Http/ProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down Expand Up @@ -94,7 +94,7 @@ public function setUp()

public function testBasicChallenge()
{
// Trying to authenticate without sending an Proxy-Authorization header
// Trying to authenticate without sending a Proxy-Authorization header
// should result in a 407 reply with a Proxy-Authenticate header, and a
// false result.

Expand All @@ -110,7 +110,7 @@ public function testBasicChallenge()

public function testDigestChallenge()
{
// Trying to authenticate without sending an Proxy-Authorization header
// Trying to authenticate without sending a Proxy-Authorization header
// should result in a 407 reply with a Proxy-Authenticate header, and a
// false result.

Expand All @@ -123,7 +123,7 @@ public function testDigestChallenge()

public function testBothChallenges()
{
// Trying to authenticate without sending an Proxy-Authorization header
// Trying to authenticate without sending a Proxy-Authorization header
// should result in a 407 reply with at least one Proxy-Authenticate
// header, and a false result.

Expand Down
2 changes: 1 addition & 1 deletion test/Adapter/Http/TestAsset/BasicAuthObjectResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
52 changes: 52 additions & 0 deletions test/Adapter/HttpTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Authentication
*/

namespace ZendTest\Authentication\Adapter;

use Zend\Authentication\Adapter;

class HttpTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Wrapper
*/
protected $_wrapper;

public function setUp()
{
$config = array(
'accept_schemes' => 'basic',
'realm' => 'testing',
);

$this->_wrapper = new Wrapper($config);
}

public function tearDown()
{
unset($this->_wrapper);
}

/**
* @expectedException PHPUnit_Framework_Error_Deprecated
*/
public function testProtectedMethodChallengeClientTriggersErrorDeprecated()
{
$this->_wrapper->_challengeClient();
}
}

class Wrapper extends Adapter\Http
{
public function __call($method, $args)
{
return call_user_func_array(array($this, $method), $args);
}
}
2 changes: 1 addition & 1 deletion test/Adapter/Ldap/OfflineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
2 changes: 1 addition & 1 deletion test/Adapter/Ldap/OnlineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
2 changes: 1 addition & 1 deletion test/Adapter/TestAsset/OpenIdResponseHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
2 changes: 1 addition & 1 deletion test/AuthenticationServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
2 changes: 1 addition & 1 deletion test/Storage/ChainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
Loading

0 comments on commit c1bb548

Please # to comment.