mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-23 13:39:48 +05:30
Optimised regex and re-added trim() following conversation in #52
This commit is contained in:
parent
ec9c39c108
commit
05d4b68586
@ -251,9 +251,9 @@ class Resource
|
|||||||
// 2nd request: Authorization: Bearer XXX, Bearer XXX
|
// 2nd request: Authorization: Bearer XXX, Bearer XXX
|
||||||
if (strpos($header, ',') !== false) {
|
if (strpos($header, ',') !== false) {
|
||||||
$headerPart = explode(',', $header);
|
$headerPart = explode(',', $header);
|
||||||
$accessToken = preg_replace('/^(?:\s+)?Bearer(\s{1})/', '', $headerPart[0]);
|
$accessToken = trim(preg_replace('/^(?:\s+)?Bearer\s/', '', $headerPart[0]));
|
||||||
} else {
|
} else {
|
||||||
$accessToken = preg_replace('/^(?:\s+)?Bearer(\s{1})/', '', $header);
|
$accessToken = trim(preg_replace('/^(?:\s+)?Bearer\s/', '', $header));
|
||||||
}
|
}
|
||||||
$accessToken = ($accessToken === 'Bearer') ? '' : $accessToken;
|
$accessToken = ($accessToken === 'Bearer') ? '' : $accessToken;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user