merged branch mvrhov/1813_regression (PR #4551)
Commits -------5d88255
Authorization header should only be rebuild when Basic Auth scheme is used Discussion ---------- [Regression fix] Authorization header should only be rebuild when Basic Auth scheme is used Bug fix: yes Feature addition: no Backwards compatibility break: no Symfony2 tests pass: yes Fixes the following tickets: fixes regression introduced by #1813 Todo: N/A License of the code: MIT --------------------------------------------------------------------------- by travisbot at 2012-06-11T14:40:28Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1592604) (merged cf5ee26a into27100ba4
). --------------------------------------------------------------------------- by mvrhov at 2012-06-12T06:13:01Z fixed --------------------------------------------------------------------------- by travisbot at 2012-06-12T06:14:55Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1598555) (merged5d88255d
into27100ba4
).
This commit is contained in:
commit
41f48b7e6c
@ -56,8 +56,8 @@ class ServerBag extends ParameterBag
|
|||||||
$authorizationHeader = $this->parameters['REDIRECT_HTTP_AUTHORIZATION'];
|
$authorizationHeader = $this->parameters['REDIRECT_HTTP_AUTHORIZATION'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode AUTHORIZATION header into PHP_AUTH_USER and PHP_AUTH_PW
|
// Decode AUTHORIZATION header into PHP_AUTH_USER and PHP_AUTH_PW when authorization header is basic
|
||||||
if (null !== $authorizationHeader) {
|
if ((null !== $authorizationHeader) && (0 === stripos($authorizationHeader, 'basic'))) {
|
||||||
$exploded = explode(':', base64_decode(substr($authorizationHeader, 6)));
|
$exploded = explode(':', base64_decode(substr($authorizationHeader, 6)));
|
||||||
if (count($exploded) == 2) {
|
if (count($exploded) == 2) {
|
||||||
list($headers['PHP_AUTH_USER'], $headers['PHP_AUTH_PW']) = $exploded;
|
list($headers['PHP_AUTH_USER'], $headers['PHP_AUTH_PW']) = $exploded;
|
||||||
|
@ -88,4 +88,14 @@ class ServerBagTest extends \PHPUnit_Framework_TestCase
|
|||||||
'PHP_AUTH_PW' => ''
|
'PHP_AUTH_PW' => ''
|
||||||
), $bag->getHeaders());
|
), $bag->getHeaders());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testOAuthBearerAuth()
|
||||||
|
{
|
||||||
|
$headerContent = 'Bearer L-yLEOr9zhmUYRkzN1jwwxwQ-PBNiKDc8dgfB4hTfvo';
|
||||||
|
$bag = new ServerBag(array('HTTP_AUTHORIZATION' => $headerContent));
|
||||||
|
|
||||||
|
$this->assertEquals(array(
|
||||||
|
'AUTHORIZATION' => $headerContent,
|
||||||
|
), $bag->getHeaders());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user