Fixed silliness with access token verification

This commit is contained in:
Alex Bilbie 2013-02-08 11:45:51 +00:00
parent 60b2caf41d
commit e76111c2b7
4 changed files with 14 additions and 11 deletions

View File

@ -0,0 +1,8 @@
<?php
namespace OAuth2\Exception;
class InvalidAccessTokenException extends OAuth2Exception
{
}

View File

@ -1,8 +0,0 @@
<?php
namespace OAuth2\Exception;
class MissingAccessTokenException extends OAuth2Exception
{
}

View File

@ -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;

View File

@ -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()