mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-15 17:56:14 +05:30
Removed special case for cURL
This commit is contained in:
parent
797ed66eda
commit
79b1e39798
@ -192,18 +192,7 @@ class ResourceServer extends AbstractServer
|
|||||||
public function determineAccessToken($headersOnly = false)
|
public function determineAccessToken($headersOnly = false)
|
||||||
{
|
{
|
||||||
if ($header = $this->getRequest()->headers->get('Authorization')) {
|
if ($header = $this->getRequest()->headers->get('Authorization')) {
|
||||||
// Check for special case, because cURL sometimes does an
|
$accessToken = trim(preg_replace('/^(?:\s+)?Bearer\s/', '', $header));
|
||||||
// internal second request and doubles the authorization header,
|
|
||||||
// which always resulted in an error.
|
|
||||||
//
|
|
||||||
// 1st request: Authorization: Bearer XXX
|
|
||||||
// 2nd request: Authorization: Bearer XXX, Bearer XXX
|
|
||||||
if (strpos($header, ',') !== false) {
|
|
||||||
$headerPart = explode(',', $header);
|
|
||||||
$accessToken = trim(preg_replace('/^(?:\s+)?Bearer\s/', '', $headerPart[0]));
|
|
||||||
} else {
|
|
||||||
$accessToken = trim(preg_replace('/^(?:\s+)?Bearer\s/', '', $header));
|
|
||||||
}
|
|
||||||
$accessToken = ($accessToken === 'Bearer') ? '' : $accessToken;
|
$accessToken = ($accessToken === 'Bearer') ? '' : $accessToken;
|
||||||
} elseif ($headersOnly === false) {
|
} elseif ($headersOnly === false) {
|
||||||
$accessToken = $this->getRequest()->request->get($this->tokenKey);
|
$accessToken = $this->getRequest()->request->get($this->tokenKey);
|
||||||
|
Loading…
Reference in New Issue
Block a user