mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-15 09:47:46 +05:30
Throw MissingAccessTokenException in the Resource server when no token exists
This commit is contained in:
parent
4486b7120f
commit
d7c1c50269
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* OAuth 2.0 Missing Access Token Exception
|
||||||
|
*
|
||||||
|
* @package php-loep/oauth2-server
|
||||||
|
* @author Woody Gilk <woody@shadowhand.me>
|
||||||
|
* @copyright Copyright (c) 2014 PHP League of Extraordinary Packages
|
||||||
|
* @license http://mit-license.org/
|
||||||
|
* @link http://github.com/php-loep/oauth2-server
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace League\OAuth2\Server\Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MissingAccessToken Exception
|
||||||
|
*/
|
||||||
|
class MissingAccessTokenException extends OAuth2Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -4,7 +4,8 @@
|
|||||||
*
|
*
|
||||||
* @package php-loep/oauth2-server
|
* @package php-loep/oauth2-server
|
||||||
* @author Alex Bilbie <hello@alexbilbie.com>
|
* @author Alex Bilbie <hello@alexbilbie.com>
|
||||||
* @copyright Copyright (c) 2013 PHP League of Extraordinary Packages
|
* @author Woody Gilk <woody@shadowhand.me>
|
||||||
|
* @copyright Copyright (c) 2013-2014 PHP League of Extraordinary Packages
|
||||||
* @license http://mit-license.org/
|
* @license http://mit-license.org/
|
||||||
* @link http://github.com/php-loep/oauth2-server
|
* @link http://github.com/php-loep/oauth2-server
|
||||||
*/
|
*/
|
||||||
@ -274,7 +275,7 @@ class Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($accessToken)) {
|
if (empty($accessToken)) {
|
||||||
throw new Exception\InvalidAccessTokenException('Access token is missing');
|
throw new Exception\MissingAccessTokenException('Access token is missing');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $accessToken;
|
return $accessToken;
|
||||||
|
@ -66,7 +66,7 @@ class Resource_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException League\OAuth2\Server\Exception\InvalidAccessTokenException
|
* @expectedException League\OAuth2\Server\Exception\MissingAccessTokenException
|
||||||
*/
|
*/
|
||||||
public function test_determineAccessToken_missingToken()
|
public function test_determineAccessToken_missingToken()
|
||||||
{
|
{
|
||||||
@ -84,7 +84,7 @@ class Resource_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException League\OAuth2\Server\Exception\InvalidAccessTokenException
|
* @expectedException League\OAuth2\Server\Exception\MissingAccessTokenException
|
||||||
*/
|
*/
|
||||||
public function test_determineAccessToken_brokenCurlRequest()
|
public function test_determineAccessToken_brokenCurlRequest()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user