mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-01-12 06:42:04 +05:30
Test fixes
This commit is contained in:
parent
4ab9c52767
commit
6e74de50e5
tests
@ -95,7 +95,7 @@ class BearerResponseTypeTest extends \PHPUnit_Framework_TestCase
|
||||
$request = new ServerRequest();
|
||||
$request = $request->withHeader('authorization', sprintf('Bearer %s', $json->access_token));
|
||||
|
||||
$request = $responseType->determineAccessTokenInHeader($request);
|
||||
$request = $responseType->validateAccessToken($request);
|
||||
|
||||
$this->assertEquals('abcdef', $request->getAttribute('oauth_access_token_id'));
|
||||
$this->assertEquals('clientName', $request->getAttribute('oauth_client_id'));
|
||||
@ -138,7 +138,7 @@ class BearerResponseTypeTest extends \PHPUnit_Framework_TestCase
|
||||
$request = $request->withHeader('authorization', sprintf('Bearer %s', $json->access_token . 'foo'));
|
||||
|
||||
try {
|
||||
$responseType->determineAccessTokenInHeader($request);
|
||||
$responseType->validateAccessToken($request);
|
||||
} catch (OAuthServerException $e) {
|
||||
$this->assertEquals(
|
||||
'Access token could not be verified',
|
||||
@ -184,7 +184,7 @@ class BearerResponseTypeTest extends \PHPUnit_Framework_TestCase
|
||||
$request = $request->withHeader('authorization', sprintf('Bearer %s', $json->access_token));
|
||||
|
||||
try {
|
||||
$responseType->determineAccessTokenInHeader($request);
|
||||
$responseType->validateAccessToken($request);
|
||||
} catch (OAuthServerException $e) {
|
||||
$this->assertEquals(
|
||||
'Access token has been revoked',
|
||||
@ -207,7 +207,7 @@ class BearerResponseTypeTest extends \PHPUnit_Framework_TestCase
|
||||
$request = $request->withHeader('authorization', 'Bearer blah');
|
||||
|
||||
try {
|
||||
$responseType->determineAccessTokenInHeader($request);
|
||||
$responseType->validateAccessToken($request);
|
||||
} catch (OAuthServerException $e) {
|
||||
$this->assertEquals(
|
||||
'The JWT string must have two dots',
|
||||
|
@ -131,7 +131,7 @@ class ServerTest extends \PHPUnit_Framework_TestCase
|
||||
);
|
||||
|
||||
try {
|
||||
$server->validateRequest(new ServerRequest());
|
||||
$server->validateAuthenticatedRequest(new ServerRequest());
|
||||
} catch (OAuthServerException $e) {
|
||||
$this->assertEquals('Missing "Authorization" header', $e->getHint());
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ class StubResponseType extends AbstractResponseType
|
||||
*
|
||||
* @return \Psr\Http\Message\ServerRequestInterface
|
||||
*/
|
||||
public function determineAccessTokenInHeader(ServerRequestInterface $request)
|
||||
public function validateAccessToken(ServerRequestInterface $request)
|
||||
{
|
||||
if ($request->getHeader('authorization')[0] === 'Basic test') {
|
||||
return $request->withAttribute('oauth_access_token_id', 'test');
|
||||
|
Loading…
x
Reference in New Issue
Block a user