mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-24 22:19:58 +05:30
Merge remote-tracking branch 'thephpleague/master' into fix-bug-hmac-encoding
This commit is contained in:
commit
d21374fb0b
@ -19,6 +19,7 @@ use League\OAuth2\Server\Storage\ClientInterface;
|
||||
use League\OAuth2\Server\Storage\ScopeInterface;
|
||||
use League\OAuth2\Server\Storage\SessionInterface;
|
||||
use League\OAuth2\Server\TokenType\Bearer;
|
||||
use League\OAuth2\Server\TokenType\MAC;
|
||||
|
||||
/**
|
||||
* OAuth 2.0 Resource Server
|
||||
@ -139,7 +140,7 @@ class ResourceServer extends AbstractServer
|
||||
{
|
||||
if ($this->getRequest()->headers->get('Authorization') !== null) {
|
||||
$accessToken = $this->getTokenType()->determineAccessTokenInHeader($this->getRequest());
|
||||
} elseif ($headerOnly === false) {
|
||||
} elseif ($headerOnly === false && (! $this->getTokenType() instanceof MAC)) {
|
||||
$accessToken = ($this->getRequest()->server->get('REQUEST_METHOD') === 'GET')
|
||||
? $this->getRequest()->query->get($this->tokenKey)
|
||||
: $this->getRequest()->request->get($this->tokenKey);
|
||||
|
@ -36,6 +36,10 @@ class MAC extends AbstractTokenType implements TokenTypeInterface
|
||||
'mac_algorithm' => 'hmac-sha-256',
|
||||
];
|
||||
|
||||
if (!is_null($this->getParam('refresh_token'))) {
|
||||
$response['refresh_token'] = $this->getParam('refresh_token');
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -61,7 +65,7 @@ class MAC extends AbstractTokenType implements TokenTypeInterface
|
||||
array_map(function ($param) use (&$params) {
|
||||
$param = trim($param);
|
||||
|
||||
preg_match_all('/([a-zA-Z]*)="([\w=]*)"/', $param, $matches);
|
||||
preg_match_all('/([a-zA-Z]*)="([\w=\/+]*)"/', $param, $matches);
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
if (count($matches) !== 3) {
|
||||
@ -105,7 +109,7 @@ class MAC extends AbstractTokenType implements TokenTypeInterface
|
||||
$timestamp,
|
||||
$nonce,
|
||||
strtoupper($request->getMethod()),
|
||||
$request->getUri(),
|
||||
$request->getRequestUri(),
|
||||
$request->getHost(),
|
||||
$request->getPort(),
|
||||
];
|
||||
|
@ -52,7 +52,7 @@ class MacTest extends \PHPUnit_Framework_TestCase
|
||||
$ts,
|
||||
'foo',
|
||||
strtoupper($request->getMethod()),
|
||||
$request->getUri(),
|
||||
$request->getRequestUri(),
|
||||
$request->getHost(),
|
||||
$request->getPort(),
|
||||
'ext'
|
||||
|
Loading…
Reference in New Issue
Block a user