mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-01 16:33:07 +05:30
Merge pull request #342 from gaomd/master
Fix #328, strict check Bearer token
This commit is contained in:
commit
2496653968
@ -38,9 +38,16 @@ class Bearer extends AbstractTokenType implements TokenTypeInterface
|
|||||||
*/
|
*/
|
||||||
public function determineAccessTokenInHeader(Request $request)
|
public function determineAccessTokenInHeader(Request $request)
|
||||||
{
|
{
|
||||||
$header = $request->headers->get('Authorization');
|
if ($request->headers->has('Authorization') === false) {
|
||||||
$accessToken = trim(preg_replace('/^(?:\s+)?Bearer\s/', '', $header));
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return ($accessToken === 'Bearer') ? '' : $accessToken;
|
$header = $request->headers->get('Authorization');
|
||||||
|
|
||||||
|
if (substr($header, 0, 7) !== 'Bearer ') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return trim(substr($header, 7));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user