Changed Case of Oauth2 namespace to OAuth2 namespace

This commit is contained in:
Daniel Horrigan 2013-01-08 16:35:29 -05:00
parent 385111a1f2
commit c12472857b
14 changed files with 60 additions and 60 deletions

View File

@ -9,7 +9,7 @@ The framework is provided as a Composer package which can be installed by adding
```javascript
{
"require": {
"lncd\Oauth2": "*"
"lncd\OAuth2": "*"
}
}
```

View File

@ -639,7 +639,7 @@ class Server
$userId = call_user_func($this->_grantTypeCallbacks['password'], $params['username'], $params['password']);
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
@ -730,7 +730,7 @@ class Server
$sessionId = $this->_dbCall('validateRefreshToken', $params['refresh_token'], $params['client_id']);
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
@ -778,7 +778,7 @@ class Server
}
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();

View File

@ -100,9 +100,9 @@ abstract class IDP {
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())
{
@ -191,24 +191,24 @@ abstract class IDP {
if (isset($result['error']) && ! empty($result['error'])) {
throw new \Oauth2\Client\IDPException($result);
throw new \OAuth2\Client\IDPException($result);
}
switch ($params['grant_type']) {
case 'authorization_code':
return \Oauth2\Client\Token::factory('access', $result);
return \OAuth2\Client\Token::factory('access', $result);
break;
case 'refresh_token':
return \Oauth2\Client\Token::factory('refresh', $result);
return \OAuth2\Client\Token::factory('refresh', $result);
break;
}
}
public function getUserDetails(\Oauth2\Client\Token\Access $token)
public function getUserDetails(\OAuth2\Client\Token\Access $token)
{
$url = $this->urlUserDetails($token);
@ -223,7 +223,7 @@ abstract class IDP {
catch (\Guzzle\Http\Exception\BadResponseException $e)
{
$raw_response = explode("\n", $e->getResponse());
throw new \Oauth2\Client\IDPException(end($raw_response));
throw new \OAuth2\Client\IDPException(end($raw_response));
}
}

View File

@ -1,6 +1,6 @@
<?php
class Blooie extends Oauth2\Client\IDP
class Blooie extends OAuth2\Client\IDP
{
public $scope = array('user.profile', 'user.picture');
@ -16,7 +16,7 @@ class Blooie extends Oauth2\Client\IDP
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(
'access_token' => $token->access_token,

View File

@ -9,7 +9,7 @@
* @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');
@ -23,7 +23,7 @@ class Facebook extends Oauth2\Client\IDP
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(
'access_token' => $token->access_token,

View File

@ -9,7 +9,7 @@
* @license http://philsturgeon.co.uk/code/dbad-license
*/
class Foursquare extends Oauth2\Client\IDP
class Foursquare extends OAuth2\Client\IDP
{
public $method = 'POST';
@ -23,7 +23,7 @@ class Foursquare extends Oauth2\Client\IDP
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(
'oauth_token' => $token->access_token,

View File

@ -9,7 +9,7 @@
* @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()
{

View File

@ -1,6 +1,6 @@
<?php
namespace Oauth2\Client;
namespace OAuth2\Client;
abstract class Token
{
@ -16,7 +16,7 @@ abstract class Token
{
include_once 'Token/'.ucfirst(strtolower($name)).'.php';
$class = 'Oauth2\Client\Token\\'.ucfirst($name);
$class = 'OAuth2\Client\Token\\'.ucfirst($name);
return new $class($options);
}

View File

@ -1,6 +1,6 @@
<?php
namespace Oauth2\Client\Token;
namespace OAuth2\Client\Token;
/**
* OAuth2 Token
@ -11,7 +11,7 @@ namespace Oauth2\Client\Token;
* @copyright (c) 2011 HappyNinjas Ltd
*/
class Access extends \Oauth2\Client\Token
class Access extends \OAuth2\Client\Token
{
/**
* @var string accessToken

View File

@ -8,7 +8,7 @@
* @copyright (c) 2011 HappyNinjas Ltd
*/
class Authorize extends \Oauth2\Client\Token
class Authorize extends \OAuth2\Client\Token
{
/**
* @var string code

View File

@ -1,6 +1,6 @@
<?php
use Oauth2\Authentication\Database;
use OAuth2\Authentication\Database;
class OAuthdb implements Database
{

View File

@ -4,17 +4,17 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
{
public function setUp()
{
$this->oauth = new Oauth2\Authentication\Server();
$this->oauth = new OAuth2\Authentication\Server();
require_once 'database_mock.php';
$this->oauthdb = new OAuthdb();
$this->assertInstanceOf('Oauth2\Authentication\Database', $this->oauthdb);
$this->assertInstanceOf('OAuth2\Authentication\Database', $this->oauthdb);
$this->oauth->registerDbAbstractor($this->oauthdb);
}
public function test_setupWithOptions()
{
$o = new Oauth2\Authentication\Server(array(
$o = new OAuth2\Authentication\Server(array(
'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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
public function test_noRegisteredDatabaseAbstractor()
@ -894,8 +894,8 @@ class Authentication_Server_test extends PHPUnit_Framework_TestCase
}
/**
* @expectedException Oauth2\Authentication\ServerException
* @expectedExceptionMessage Registered database abstractor is not an instance of Oauth2\Authentication\Database
* @expectedException OAuth2\Authentication\ServerException
* @expectedExceptionMessage Registered database abstractor is not an instance of OAuth2\Authentication\Database
*/
public function test_invalidRegisteredDatabaseAbstractor()
{

View File

@ -1,6 +1,6 @@
<?php
use Oauth2\Resource\Database;
use OAuth2\Resource\Database;
class ResourceDB implements Database
{

View File

@ -5,10 +5,10 @@ class Resource_Server_test extends PHPUnit_Framework_TestCase {
function setUp()
{
require_once('database_mock.php');
$this->server = new Oauth2\Resource\Server();
$this->server = new OAuth2\Resource\Server();
$this->db = new ResourceDB();
$this->assertInstanceOf('Oauth2\Resource\Database', $this->db);
$this->assertInstanceOf('OAuth2\Resource\Database', $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
*/
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
*/
function test_init_wrongToken()