mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-23 05:29:52 +05:30
Changed Case of Oauth2 namespace to OAuth2 namespace
This commit is contained in:
parent
385111a1f2
commit
c12472857b
@ -9,7 +9,7 @@ The framework is provided as a Composer package which can be installed by adding
|
|||||||
```javascript
|
```javascript
|
||||||
{
|
{
|
||||||
"require": {
|
"require": {
|
||||||
"lncd\Oauth2": "*"
|
"lncd\OAuth2": "*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -639,7 +639,7 @@ class Server
|
|||||||
$userId = call_user_func($this->_grantTypeCallbacks['password'], $params['username'], $params['password']);
|
$userId = call_user_func($this->_grantTypeCallbacks['password'], $params['username'], $params['password']);
|
||||||
|
|
||||||
if ($userId === false) {
|
if ($userId === false) {
|
||||||
throw new \Oauth2\Authentication\ClientException($this->errors['invalid_credentials'], 0);
|
throw new \OAuth2\Authentication\ClientException($this->errors['invalid_credentials'], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate an access token
|
// Generate an access token
|
||||||
@ -730,7 +730,7 @@ class Server
|
|||||||
$sessionId = $this->_dbCall('validateRefreshToken', $params['refresh_token'], $params['client_id']);
|
$sessionId = $this->_dbCall('validateRefreshToken', $params['refresh_token'], $params['client_id']);
|
||||||
|
|
||||||
if ($sessionId === false) {
|
if ($sessionId === false) {
|
||||||
throw new \Oauth2\Authentication\ClientException($this->errors['invalid_refresh'], 0);
|
throw new \OAuth2\Authentication\ClientException($this->errors['invalid_refresh'], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate new tokens
|
// Generate new tokens
|
||||||
@ -778,7 +778,7 @@ class Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $this->_db instanceof Database) {
|
if ( ! $this->_db instanceof Database) {
|
||||||
throw new ServerException('Registered database abstractor is not an instance of Oauth2\Authentication\Database');
|
throw new ServerException('Registered database abstractor is not an instance of OAuth2\Authentication\Database');
|
||||||
}
|
}
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
|
@ -100,9 +100,9 @@ abstract class IDP {
|
|||||||
|
|
||||||
abstract public function urlAccessToken();
|
abstract public function urlAccessToken();
|
||||||
|
|
||||||
abstract public function urlUserDetails(\Oauth2\Client\Token\Access $token);
|
abstract public function urlUserDetails(\OAuth2\Client\Token\Access $token);
|
||||||
|
|
||||||
abstract public function userDetails($response, \Oauth2\Client\Token\Access $token);
|
abstract public function userDetails($response, \OAuth2\Client\Token\Access $token);
|
||||||
|
|
||||||
public function authorize($options = array())
|
public function authorize($options = array())
|
||||||
{
|
{
|
||||||
@ -191,24 +191,24 @@ abstract class IDP {
|
|||||||
|
|
||||||
if (isset($result['error']) && ! empty($result['error'])) {
|
if (isset($result['error']) && ! empty($result['error'])) {
|
||||||
|
|
||||||
throw new \Oauth2\Client\IDPException($result);
|
throw new \OAuth2\Client\IDPException($result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($params['grant_type']) {
|
switch ($params['grant_type']) {
|
||||||
|
|
||||||
case 'authorization_code':
|
case 'authorization_code':
|
||||||
return \Oauth2\Client\Token::factory('access', $result);
|
return \OAuth2\Client\Token::factory('access', $result);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'refresh_token':
|
case 'refresh_token':
|
||||||
return \Oauth2\Client\Token::factory('refresh', $result);
|
return \OAuth2\Client\Token::factory('refresh', $result);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUserDetails(\Oauth2\Client\Token\Access $token)
|
public function getUserDetails(\OAuth2\Client\Token\Access $token)
|
||||||
{
|
{
|
||||||
$url = $this->urlUserDetails($token);
|
$url = $this->urlUserDetails($token);
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ abstract class IDP {
|
|||||||
catch (\Guzzle\Http\Exception\BadResponseException $e)
|
catch (\Guzzle\Http\Exception\BadResponseException $e)
|
||||||
{
|
{
|
||||||
$raw_response = explode("\n", $e->getResponse());
|
$raw_response = explode("\n", $e->getResponse());
|
||||||
throw new \Oauth2\Client\IDPException(end($raw_response));
|
throw new \OAuth2\Client\IDPException(end($raw_response));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Blooie extends Oauth2\Client\IDP
|
class Blooie extends OAuth2\Client\IDP
|
||||||
{
|
{
|
||||||
public $scope = array('user.profile', 'user.picture');
|
public $scope = array('user.profile', 'user.picture');
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ class Blooie extends Oauth2\Client\IDP
|
|||||||
return 'https://bloo.ie/oauth/access_token';
|
return 'https://bloo.ie/oauth/access_token';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUserInfo(Oauth2\Token\Access $token)
|
public function getUserInfo(OAuth2\Token\Access $token)
|
||||||
{
|
{
|
||||||
$url = 'https://graph.facebook.com/me?'.http_build_query(array(
|
$url = 'https://graph.facebook.com/me?'.http_build_query(array(
|
||||||
'access_token' => $token->access_token,
|
'access_token' => $token->access_token,
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Facebook extends Oauth2\Client\IDP
|
class Facebook extends OAuth2\Client\IDP
|
||||||
{
|
{
|
||||||
protected $scope = array('offline_access', 'email', 'read_stream');
|
protected $scope = array('offline_access', 'email', 'read_stream');
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ class Facebook extends Oauth2\Client\IDP
|
|||||||
return 'https://graph.facebook.com/oauth/access_token';
|
return 'https://graph.facebook.com/oauth/access_token';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUserInfo(Oauth2\Token\Access $token)
|
public function getUserInfo(OAuth2\Token\Access $token)
|
||||||
{
|
{
|
||||||
$url = 'https://graph.facebook.com/me?'.http_build_query(array(
|
$url = 'https://graph.facebook.com/me?'.http_build_query(array(
|
||||||
'access_token' => $token->access_token,
|
'access_token' => $token->access_token,
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Foursquare extends Oauth2\Client\IDP
|
class Foursquare extends OAuth2\Client\IDP
|
||||||
{
|
{
|
||||||
public $method = 'POST';
|
public $method = 'POST';
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ class Foursquare extends Oauth2\Client\IDP
|
|||||||
return 'https://foursquare.com/oauth2/access_token';
|
return 'https://foursquare.com/oauth2/access_token';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUserInfo(Oauth2\Token\Access $token)
|
public function getUserInfo(OAuth2\Token\Access $token)
|
||||||
{
|
{
|
||||||
$url = 'https://api.foursquare.com/v2/users/self?'.http_build_query(array(
|
$url = 'https://api.foursquare.com/v2/users/self?'.http_build_query(array(
|
||||||
'oauth_token' => $token->access_token,
|
'oauth_token' => $token->access_token,
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class OAuth2_Provider_Github extends Oauth2\Client\IDP
|
class OAuth2_Provider_Github extends OAuth2\Client\IDP
|
||||||
{
|
{
|
||||||
public function urlAuthorize()
|
public function urlAuthorize()
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Oauth2\Client;
|
namespace OAuth2\Client;
|
||||||
|
|
||||||
abstract class Token
|
abstract class Token
|
||||||
{
|
{
|
||||||
@ -16,7 +16,7 @@ abstract class Token
|
|||||||
{
|
{
|
||||||
include_once 'Token/'.ucfirst(strtolower($name)).'.php';
|
include_once 'Token/'.ucfirst(strtolower($name)).'.php';
|
||||||
|
|
||||||
$class = 'Oauth2\Client\Token\\'.ucfirst($name);
|
$class = 'OAuth2\Client\Token\\'.ucfirst($name);
|
||||||
|
|
||||||
return new $class($options);
|
return new $class($options);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Oauth2\Client\Token;
|
namespace OAuth2\Client\Token;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OAuth2 Token
|
* OAuth2 Token
|
||||||
@ -11,7 +11,7 @@ namespace Oauth2\Client\Token;
|
|||||||
* @copyright (c) 2011 HappyNinjas Ltd
|
* @copyright (c) 2011 HappyNinjas Ltd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Access extends \Oauth2\Client\Token
|
class Access extends \OAuth2\Client\Token
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var string accessToken
|
* @var string accessToken
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* @copyright (c) 2011 HappyNinjas Ltd
|
* @copyright (c) 2011 HappyNinjas Ltd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Authorize extends \Oauth2\Client\Token
|
class Authorize extends \OAuth2\Client\Token
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var string code
|
* @var string code
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Oauth2\Authentication\Database;
|
use OAuth2\Authentication\Database;
|
||||||
|
|
||||||
class OAuthdb implements Database
|
class OAuthdb implements Database
|
||||||
{
|
{
|
||||||
|
@ -4,17 +4,17 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->oauth = new Oauth2\Authentication\Server();
|
$this->oauth = new OAuth2\Authentication\Server();
|
||||||
|
|
||||||
require_once 'database_mock.php';
|
require_once 'database_mock.php';
|
||||||
$this->oauthdb = new OAuthdb();
|
$this->oauthdb = new OAuthdb();
|
||||||
$this->assertInstanceOf('Oauth2\Authentication\Database', $this->oauthdb);
|
$this->assertInstanceOf('OAuth2\Authentication\Database', $this->oauthdb);
|
||||||
$this->oauth->registerDbAbstractor($this->oauthdb);
|
$this->oauth->registerDbAbstractor($this->oauthdb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_setupWithOptions()
|
public function test_setupWithOptions()
|
||||||
{
|
{
|
||||||
$o = new Oauth2\Authentication\Server(array(
|
$o = new OAuth2\Authentication\Server(array(
|
||||||
'access_token_ttl' => 86400
|
'access_token_ttl' => 86400
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 0
|
* @expectedExceptionCode 0
|
||||||
*/
|
*/
|
||||||
public function test_checkClientAuthoriseParams_missingClientId()
|
public function test_checkClientAuthoriseParams_missingClientId()
|
||||||
@ -125,7 +125,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 0
|
* @expectedExceptionCode 0
|
||||||
*/
|
*/
|
||||||
public function test_checkClientAuthoriseParams_missingRedirectUri()
|
public function test_checkClientAuthoriseParams_missingRedirectUri()
|
||||||
@ -136,7 +136,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 0
|
* @expectedExceptionCode 0
|
||||||
*/
|
*/
|
||||||
public function test_checkClientAuthoriseParams_missingResponseType()
|
public function test_checkClientAuthoriseParams_missingResponseType()
|
||||||
@ -148,7 +148,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 0
|
* @expectedExceptionCode 0
|
||||||
*/
|
*/
|
||||||
public function test_checkClientAuthoriseParams_missingScopes()
|
public function test_checkClientAuthoriseParams_missingScopes()
|
||||||
@ -162,7 +162,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 4
|
* @expectedExceptionCode 4
|
||||||
*/
|
*/
|
||||||
public function test_checkClientAuthoriseParams_invalidScopes()
|
public function test_checkClientAuthoriseParams_invalidScopes()
|
||||||
@ -176,7 +176,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 8
|
* @expectedExceptionCode 8
|
||||||
*/
|
*/
|
||||||
public function test_checkClientAuthoriseParams_invalidClient()
|
public function test_checkClientAuthoriseParams_invalidClient()
|
||||||
@ -190,7 +190,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 3
|
* @expectedExceptionCode 3
|
||||||
*/
|
*/
|
||||||
public function test_checkClientAuthoriseParams_invalidResponseType()
|
public function test_checkClientAuthoriseParams_invalidResponseType()
|
||||||
@ -247,7 +247,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 7
|
* @expectedExceptionCode 7
|
||||||
*/
|
*/
|
||||||
public function test_issueAccessTokenNoRegisteredGrant()
|
public function test_issueAccessTokenNoRegisteredGrant()
|
||||||
@ -537,7 +537,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 0
|
* @expectedExceptionCode 0
|
||||||
*/
|
*/
|
||||||
public function test_issueAccessToken_refresh_tokenMissingToken()
|
public function test_issueAccessToken_refresh_tokenMissingToken()
|
||||||
@ -584,7 +584,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 0
|
* @expectedExceptionCode 0
|
||||||
*/
|
*/
|
||||||
public function test_issueAccessToken_invalid_refresh_token()
|
public function test_issueAccessToken_invalid_refresh_token()
|
||||||
@ -632,7 +632,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ServerException
|
* @expectedException OAuth2\Authentication\ServerException
|
||||||
* @expectedExceptionCode 0
|
* @expectedExceptionCode 0
|
||||||
*/
|
*/
|
||||||
public function test_issueAccessToken_password_grant_Missing_Callback()
|
public function test_issueAccessToken_password_grant_Missing_Callback()
|
||||||
@ -707,7 +707,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 0
|
* @expectedExceptionCode 0
|
||||||
*/
|
*/
|
||||||
public function test_issueAccessToken_password_grant_wrongCreds()
|
public function test_issueAccessToken_password_grant_wrongCreds()
|
||||||
@ -726,7 +726,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 0
|
* @expectedExceptionCode 0
|
||||||
*/
|
*/
|
||||||
public function test_issueAccessToken_password_grant_missingUsername()
|
public function test_issueAccessToken_password_grant_missingUsername()
|
||||||
@ -743,7 +743,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 0
|
* @expectedExceptionCode 0
|
||||||
*/
|
*/
|
||||||
public function test_issueAccessToken_password_grant_missingPassword()
|
public function test_issueAccessToken_password_grant_missingPassword()
|
||||||
@ -761,7 +761,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 0
|
* @expectedExceptionCode 0
|
||||||
*/
|
*/
|
||||||
public function test_issueAccessToken_missingGrantType()
|
public function test_issueAccessToken_missingGrantType()
|
||||||
@ -770,7 +770,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 7
|
* @expectedExceptionCode 7
|
||||||
*/
|
*/
|
||||||
public function test_issueAccessToken_unsupportedGrantType()
|
public function test_issueAccessToken_unsupportedGrantType()
|
||||||
@ -781,7 +781,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 0
|
* @expectedExceptionCode 0
|
||||||
*/
|
*/
|
||||||
public function test_completeAuthCodeGrant_missingClientId()
|
public function test_completeAuthCodeGrant_missingClientId()
|
||||||
@ -794,7 +794,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 0
|
* @expectedExceptionCode 0
|
||||||
*/
|
*/
|
||||||
public function test_completeAuthCodeGrant_missingClientSecret()
|
public function test_completeAuthCodeGrant_missingClientSecret()
|
||||||
@ -809,7 +809,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 0
|
* @expectedExceptionCode 0
|
||||||
*/
|
*/
|
||||||
public function test_completeAuthCodeGrant_missingRedirectUri()
|
public function test_completeAuthCodeGrant_missingRedirectUri()
|
||||||
@ -825,7 +825,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 8
|
* @expectedExceptionCode 8
|
||||||
*/
|
*/
|
||||||
public function test_completeAuthCodeGrant_invalidClient()
|
public function test_completeAuthCodeGrant_invalidClient()
|
||||||
@ -842,7 +842,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 0
|
* @expectedExceptionCode 0
|
||||||
*/
|
*/
|
||||||
public function test_completeAuthCodeGrant_missingCode()
|
public function test_completeAuthCodeGrant_missingCode()
|
||||||
@ -859,7 +859,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ClientException
|
* @expectedException OAuth2\Authentication\ClientException
|
||||||
* @expectedExceptionCode 9
|
* @expectedExceptionCode 9
|
||||||
*/
|
*/
|
||||||
public function test_completeAuthCodeGrant_invalidCode()
|
public function test_completeAuthCodeGrant_invalidCode()
|
||||||
@ -877,7 +877,7 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ServerException
|
* @expectedException OAuth2\Authentication\ServerException
|
||||||
* @expectedExceptionMessage No registered database abstractor
|
* @expectedExceptionMessage No registered database abstractor
|
||||||
*/
|
*/
|
||||||
public function test_noRegisteredDatabaseAbstractor()
|
public function test_noRegisteredDatabaseAbstractor()
|
||||||
@ -894,8 +894,8 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Oauth2\Authentication\ServerException
|
* @expectedException OAuth2\Authentication\ServerException
|
||||||
* @expectedExceptionMessage Registered database abstractor is not an instance of Oauth2\Authentication\Database
|
* @expectedExceptionMessage Registered database abstractor is not an instance of OAuth2\Authentication\Database
|
||||||
*/
|
*/
|
||||||
public function test_invalidRegisteredDatabaseAbstractor()
|
public function test_invalidRegisteredDatabaseAbstractor()
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Oauth2\Resource\Database;
|
use OAuth2\Resource\Database;
|
||||||
|
|
||||||
class ResourceDB implements Database
|
class ResourceDB implements Database
|
||||||
{
|
{
|
||||||
|
@ -5,10 +5,10 @@ class Resource_Server_test extends PHPUnit_Framework_TestCase {
|
|||||||
function setUp()
|
function setUp()
|
||||||
{
|
{
|
||||||
require_once('database_mock.php');
|
require_once('database_mock.php');
|
||||||
$this->server = new Oauth2\Resource\Server();
|
$this->server = new OAuth2\Resource\Server();
|
||||||
$this->db = new ResourceDB();
|
$this->db = new ResourceDB();
|
||||||
|
|
||||||
$this->assertInstanceOf('Oauth2\Resource\Database', $this->db);
|
$this->assertInstanceOf('OAuth2\Resource\Database', $this->db);
|
||||||
$this->server->registerDbAbstractor($this->db);
|
$this->server->registerDbAbstractor($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ class Resource_Server_test extends PHPUnit_Framework_TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Oauth2\Resource\ClientException
|
* @expectedException \OAuth2\Resource\ClientException
|
||||||
* @expectedExceptionMessage An access token was not presented with the request
|
* @expectedExceptionMessage An access token was not presented with the request
|
||||||
*/
|
*/
|
||||||
function test_init_missingToken()
|
function test_init_missingToken()
|
||||||
@ -81,7 +81,7 @@ class Resource_Server_test extends PHPUnit_Framework_TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Oauth2\Resource\ClientException
|
* @expectedException \OAuth2\Resource\ClientException
|
||||||
* @expectedExceptionMessage The access token is not registered with the resource server
|
* @expectedExceptionMessage The access token is not registered with the resource server
|
||||||
*/
|
*/
|
||||||
function test_init_wrongToken()
|
function test_init_wrongToken()
|
||||||
|
Loading…
Reference in New Issue
Block a user