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