mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-16 02:08:56 +05:30
Fixed silliness with access token verification
This commit is contained in:
parent
60b2caf41d
commit
e76111c2b7
8
src/OAuth2/Exception/InvalidAccessTokenException.php
Normal file
8
src/OAuth2/Exception/InvalidAccessTokenException.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace OAuth2\Exception;
|
||||
|
||||
class InvalidAccessTokenException extends OAuth2Exception
|
||||
{
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OAuth2\Exception;
|
||||
|
||||
class MissingAccessTokenException extends OAuth2Exception
|
||||
{
|
||||
|
||||
}
|
@ -115,7 +115,7 @@ class ResourceServer
|
||||
$result = $this->storages['session']->validateAccessToken($access_token);
|
||||
|
||||
if ( ! $result) {
|
||||
return false;
|
||||
throw new Exception\InvalidAccessTokenException('Access token is not valid');
|
||||
}
|
||||
|
||||
$this->accessToken = $access_token;
|
||||
|
@ -60,7 +60,7 @@ class Resource_Server_test extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException OAuth2\Exception\InvalidAccessTokenException
|
||||
* @expectedException OAuth2\Exception\InvalidAccessTokenException
|
||||
*/
|
||||
public function test_determineAccessToken_missingToken()
|
||||
{
|
||||
@ -119,6 +119,9 @@ class Resource_Server_test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('abcdef', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException OAuth2\Exception\InvalidAccessTokenException
|
||||
*/
|
||||
public function test_isValid_notValid()
|
||||
{
|
||||
$this->session->shouldReceive('validateAccessToken')->andReturn(false);
|
||||
@ -133,7 +136,7 @@ class Resource_Server_test extends PHPUnit_Framework_TestCase
|
||||
$s = $this->returnDefault();
|
||||
$s->setRequest($request);
|
||||
|
||||
$this->assertFalse($s->isValid());
|
||||
$s->isValid();
|
||||
}
|
||||
|
||||
public function test_isValid_valid()
|
||||
|
Loading…
Reference in New Issue
Block a user