Renamed namespace to JacobKiers

This commit is contained in:
Jacob Kiers 2013-02-08 10:32:26 +00:00
parent 81a1af738b
commit 204ec8b42f
20 changed files with 123 additions and 124 deletions

View File

@ -35,7 +35,7 @@
},
"autoload": {
"psr-0": {
"GaryJones\\OAuth": "src/"
"JacobKiers\\OAuth": "src/"
}
}
}

View File

@ -5,11 +5,11 @@
* @package OAuth
* @author Andy Smith
* @author Gary Jones <gary@garyjones.co.uk>
* @license https://raw.github.com/GaryJones/OAuth/master/LICENSE MIT
* @link https://github.com/GaryJones/OAuth
* @license https://raw.github.com/jacobkiers/OAuth/master/LICENSE MIT
* @link https://github.com/jacobkiers/OAuth
*/
namespace GaryJones\OAuth;
namespace JacobKiers\OAuth;
/**
* Client holds the properties of a single client / consumer.

View File

@ -5,11 +5,11 @@
* @package OAuth
* @author Andy Smith
* @author Gary Jones <gary@garyjones.co.uk>
* @license https://raw.github.com/GaryJones/OAuth/master/LICENSE MIT
* @link https://github.com/GaryJones/OAuth
* @license https://raw.github.com/jacobkiers/OAuth/master/LICENSE MIT
* @link https://github.com/jacobkiers/OAuth
*/
namespace GaryJones\OAuth;
namespace JacobKiers\OAuth;
/**
* Credential is the blueprint for all key + secret classes.

View File

@ -5,11 +5,11 @@
* @package OAuth
* @author Andy Smith
* @author Gary Jones <gary@garyjones.co.uk>
* @license https://raw.github.com/GaryJones/OAuth/master/LICENSE MIT
* @link https://github.com/GaryJones/OAuth
* @license https://raw.github.com/jacobkiers/OAuth/master/LICENSE MIT
* @link https://github.com/jacobkiers/OAuth
*/
namespace GaryJones\OAuth;
namespace JacobKiers\OAuth;
/**
* The actual implementation of validating and assigning tokens is left up to
@ -30,8 +30,8 @@ interface DataStore
/**
* Validate a token.
*
* @param GaryJones\OAuth\Client $client
* @param GaryJones\OAuth\Token $token
* @param JacobKiers\OAuth\Client $client
* @param JacobKiers\OAuth\Token $token
* @param string $token_type Request or access token
*/
public function lookupToken(Client $client, Token $token, $token_type);
@ -39,8 +39,8 @@ interface DataStore
/**
* Validate that a nonce has not been used with the same timestamp before.
*
* @param GaryJones\OAuth\Client $client
* @param GaryJones\OAuth\Token $token
* @param JacobKiers\OAuth\Client $client
* @param JacobKiers\OAuth\Token $token
* @param string $nonce
* @param int $timestamp
*/
@ -49,7 +49,7 @@ interface DataStore
/**
* Return a new token attached to this client.
*
* @param GaryJones\OAuth\Client $client
* @param JacobKiers\OAuth\Client $client
* @param string $callback URI to store as the post-authorization callback.
*/
public function newRequestToken(Client $client, $callback = null);
@ -60,8 +60,8 @@ interface DataStore
*
* Should also invalidate the request token.
*
* @param GaryJones\OAuth\Client $client
* @param GaryJones\OAuth\Token $token
* @param JacobKiers\OAuth\Client $client
* @param JacobKiers\OAuth\Token $token
* @param string $verifier
*/
public function newAccessToken(Client $client, Token $token, $verifier = null);

View File

@ -5,11 +5,11 @@
* @package OAuth
* @author Andy Smith
* @author Gary Jones <gary@garyjones.co.uk>
* @license https://raw.github.com/GaryJones/OAuth/master/LICENSE MIT
* @link https://github.com/GaryJones/OAuth
* @license https://raw.github.com/jacobkiers/OAuth/master/LICENSE MIT
* @link https://github.com/jacobkiers/OAuth
*/
namespace GaryJones\OAuth;
namespace JacobKiers\OAuth;
/**
* The HMAC-SHA1 signature method.
@ -46,9 +46,9 @@ class HmacSha1 extends SignatureMethod
* Please note that the second encoding MUST NOT happen in the SignatureMethod, as
* OAuthRequest handles this!
*
* @param GaryJones\OAuth\Request $request
* @param GaryJones\OAuth\Client $client
* @param GaryJones\OAuth\Token $token
* @param JacobKiers\OAuth\Request $request
* @param JacobKiers\OAuth\Client $client
* @param JacobKiers\OAuth\Token $token
*
* @return string
*/

View File

@ -5,11 +5,11 @@
* @package OAuth
* @author Andy Smith
* @author Gary Jones <gary@garyjones.co.uk>
* @license https://raw.github.com/GaryJones/OAuth/master/LICENSE MIT
* @link https://github.com/GaryJones/OAuth
* @license https://raw.github.com/jacobkiers/OAuth/master/LICENSE MIT
* @link https://github.com/jacobkiers/OAuth
*/
namespace GaryJones\OAuth;
namespace JacobKiers\OAuth;
/**
* Token holds the properties of a single token.

View File

@ -5,11 +5,11 @@
* @package OAuth
* @author Andy Smith
* @author Gary Jones <gary@garyjones.co.uk>
* @license https://raw.github.com/GaryJones/OAuth/master/LICENSE MIT
* @link https://github.com/GaryJones/OAuth
* @license https://raw.github.com/jacobkiers/OAuth/master/LICENSE MIT
* @link https://github.com/jacobkiers/OAuth
*/
namespace GaryJones\OAuth;
namespace JacobKiers\OAuth;
/**
* Generic exception class.

View File

@ -5,11 +5,11 @@
* @package OAuth
* @author Andy Smith
* @author Gary Jones <gary@garyjones.co.uk>
* @license https://raw.github.com/GaryJones/OAuth/master/LICENSE MIT
* @link https://github.com/GaryJones/OAuth
* @license https://raw.github.com/jacobkiers/OAuth/master/LICENSE MIT
* @link https://github.com/jacobkiers/OAuth
*/
namespace GaryJones\OAuth;
namespace JacobKiers\OAuth;
/**
* PLAINTEXT signature method.
@ -44,9 +44,9 @@ class PlainText extends SignatureMethod
* Please note that the second encoding MUST NOT happen in the SignatureMethod, as
* OAuthRequest handles this!
*
* @param GaryJones\OAuth\Request $request
* @param GaryJones\OAuth\Client $client
* @param GaryJones\OAuth\Token $token
* @param JacobKiers\OAuth\Request $request
* @param JacobKiers\OAuth\Client $client
* @param JacobKiers\OAuth\Token $token
*
* @return string
*/

View File

@ -5,11 +5,11 @@
* @package OAuth
* @author Andy Smith
* @author Gary Jones <gary@garyjones.co.uk>
* @license https://raw.github.com/GaryJones/OAuth/master/LICENSE MIT
* @link https://github.com/GaryJones/OAuth
* @license https://raw.github.com/jacobkiers/OAuth/master/LICENSE MIT
* @link https://github.com/jacobkiers/OAuth
*/
namespace GaryJones\OAuth;
namespace JacobKiers\OAuth;
/**
* Handle an OAuth request.
@ -79,7 +79,7 @@ class Request
* @param string $http_url Request URL.
* @param array $parameters HTTP parameters.
*
* @return GaryJones\OAuth\Request
* @return JacobKiers\OAuth\Request
*/
public static function fromRequest($http_method = null, $http_url = null, $parameters = null)
{
@ -131,13 +131,13 @@ class Request
/**
* Helper function to set up the request.
*
* @param GaryJones\OAuth\Client $client
* @param GaryJones\OAuth\Token $token
* @param JacobKiers\OAuth\Client $client
* @param JacobKiers\OAuth\Token $token
* @param string $http_method
* @param string $http_url
* @param array $parameters
*
* @return GaryJones\OAuth\Request
* @return JacobKiers\OAuth\Request
*/
public static function fromClientAndToken(
Client $client,
@ -329,7 +329,7 @@ class Request
*
* @return string
*
* @throws GaryJones\OAuth\OAuthException
* @throws JacobKiers\OAuth\OAuthException
*/
public function toHeader($realm = null)
{
@ -373,8 +373,8 @@ class Request
* Build signature and add it as parameter.
*
* @param string $signature_method
* @param GaryJones\OAuth\Client $client
* @param GaryJones\OAuth\Token $token
* @param JacobKiers\OAuth\Client $client
* @param JacobKiers\OAuth\Token $token
*/
public function signRequest($signature_method, Client $client, Token $token)
{
@ -387,8 +387,8 @@ class Request
* Build signature.
*
* @param string $signature_method
* @param GaryJones\OAuth\Client $client
* @param GaryJones\OAuth\Token $token
* @param JacobKiers\OAuth\Client $client
* @param JacobKiers\OAuth\Token $token
*
* @return string
*/

View File

@ -5,11 +5,11 @@
* @package OAuth
* @author Andy Smith
* @author Gary Jones <gary@garyjones.co.uk>
* @license https://raw.github.com/GaryJones/OAuth/master/LICENSE MIT
* @link https://github.com/GaryJones/OAuth
* @license https://raw.github.com/jacobkiers/OAuth/master/LICENSE MIT
* @link https://github.com/jacobkiers/OAuth
*/
namespace GaryJones\OAuth;
namespace JacobKiers\OAuth;
/**
* The RSA-SHA1 signature method.
@ -58,16 +58,15 @@ abstract class RsaSha1 extends SignatureMethod
/**
* Build up the signature.
*
* @param GaryJones\OAuth\Request $request
* @param GaryJones\OAuth\Client $client
* @param GaryJones\OAuth\Token $token
* @param JacobKiers\OAuth\Request $request
* @param JacobKiers\OAuth\Client $client
* @param JacobKiers\OAuth\Token $token
*
* @return string
*/
public function buildSignature(Request $request, Client $client, Token $token = null)
{
$base_string = $request->getSignatureBaseString();
//$request->base_string = $base_string;
// Fetch the private key cert based on the request
$cert = $this->fetchPrivateCert($request);
@ -87,9 +86,9 @@ abstract class RsaSha1 extends SignatureMethod
/**
* Verifies that a given signature is correct.
*
* @param GaryJones\OAuth\Request $request
* @param GaryJones\OAuth\Consumer $client
* @param GaryJones\OAuth\Token $token
* @param JacobKiers\OAuth\Request $request
* @param JacobKiers\OAuth\Consumer $client
* @param JacobKiers\OAuth\Token $token
* @param string $signature
*
* @return bool

View File

@ -5,11 +5,11 @@
* @package OAuth
* @author Andy Smith
* @author Gary Jones <gary@garyjones.co.uk>
* @license https://raw.github.com/GaryJones/OAuth/master/LICENSE MIT
* @link https://github.com/GaryJones/OAuth
* @license https://raw.github.com/jacobkiers/OAuth/master/LICENSE MIT
* @link https://github.com/jacobkiers/OAuth
*/
namespace GaryJones\OAuth;
namespace JacobKiers\OAuth;
/**
* OAuth server.
@ -45,14 +45,14 @@ class Server
/**
* Data store object reference.
*
* @var GaryJones\OAuth\DataStore
* @var JacobKiers\OAuth\DataStore
*/
protected $data_store;
/**
* Construct OAuth server instance.
*
* @param GaryJones\OAuth\DataStore $data_store
* @param JacobKiers\OAuth\DataStore $data_store
*/
public function __construct(DataStore $data_store)
{
@ -62,7 +62,7 @@ class Server
/**
* Add a supported signature method.
*
* @param GaryJones\OAuth\SignatureMethod $signature_method
* @param JacobKiers\OAuth\SignatureMethod $signature_method
*/
public function addSignatureMethod(SignatureMethod $signature_method)
{
@ -77,9 +77,9 @@ class Server
*
* Returns the request token on success
*
* @param GaryJones\OAuth\Request $request
* @param JacobKiers\OAuth\Request $request
*
* @return GaryJones\OAuth\Token
* @return JacobKiers\OAuth\Token
*/
public function fetchRequestToken(Request &$request)
{
@ -103,9 +103,9 @@ class Server
*
* Returns the access token on success.
*
* @param GaryJones\OAuth\Request $request
* @param JacobKiers\OAuth\Request $request
*
* @return GaryJones\OAuth\Token
* @return JacobKiers\OAuth\Token
*/
public function fetchAccessToken(Request &$request)
{
@ -127,7 +127,7 @@ class Server
/**
* Verify an api call, checks all the parameters.
*
* @param GaryJones\OAuth\Request $request
* @param JacobKiers\OAuth\Request $request
*
* @return array Client and Token
*/
@ -145,11 +145,11 @@ class Server
/**
* Check that version is 1.0.
*
* @param GaryJones\OAuth\Request $request
* @param JacobKiers\OAuth\Request $request
*
* @return string
*
* @throws GaryJones\OAuth\OAuthException
* @throws JacobKiers\OAuth\OAuthException
*/
private function getVersion(Request &$request)
{
@ -168,11 +168,11 @@ class Server
/**
* Get the signature method name, and if it is supported.
*
* @param GaryJones\OAuth\Request $request
* @param JacobKiers\OAuth\Request $request
*
* @return string Signature method name.
*
* @throws GaryJones\OAuth\OAuthException
* @throws JacobKiers\OAuth\OAuthException
*/
private function getSignatureMethod(Request $request)
{
@ -196,11 +196,11 @@ class Server
/**
* Try to find the client for the provided request's client key.
*
* @param GaryJones\OAuth\Request $request
* @param JacobKiers\OAuth\Request $request
*
* @return GaryJones\OAuth\Client
* @return JacobKiers\OAuth\Client
*
* @throws GaryJones\OAuth\OAuthException
* @throws JacobKiers\OAuth\OAuthException
*/
private function getClient(Request $request)
{
@ -221,13 +221,13 @@ class Server
/**
* Try to find the token for the provided request's token key.
*
* @param GaryJones\OAuth\Request $request
* @param GaryJones\OAuth\Client $client
* @param JacobKiers\OAuth\Request $request
* @param JacobKiers\OAuth\Client $client
* @param string $token_type
*
* @return GaryJones\OAuth\Token
* @return JacobKiers\OAuth\Token
*
* @throws GaryJones\OAuth\OAuthException
* @throws JacobKiers\OAuth\OAuthException
*/
private function getToken(Request $request, Client $client, $token_type = 'access')
{
@ -245,11 +245,11 @@ class Server
*
* Should determine the signature method appropriately
*
* @param GaryJones\OAuth\Request $request
* @param GaryJones\OAuth\Client $client
* @param GaryJones\OAuth\Token $token
* @param JacobKiers\OAuth\Request $request
* @param JacobKiers\OAuth\Client $client
* @param JacobKiers\OAuth\Token $token
*
* @throws GaryJones\OAuth\OAuthException
* @throws JacobKiers\OAuth\OAuthException
*/
private function checkSignature(Request $request, Client $client, Token $token)
{
@ -275,7 +275,7 @@ class Server
*
* @param int $timestamp
*
* @throws GaryJones\OAuth\OAuthException
* @throws JacobKiers\OAuth\OAuthException
*/
private function checkTimestamp($timestamp)
{
@ -293,12 +293,12 @@ class Server
/**
* Check that the nonce is not repeated
*
* @param GaryJones\OAuth\Client $client
* @param GaryJones\OAuth\Token $token
* @param JacobKiers\OAuth\Client $client
* @param JacobKiers\OAuth\Token $token
* @param string $nonce
* @param int $timestamp
*
* @throws GaryJones\OAuth\OAuthException
* @throws JacobKiers\OAuth\OAuthException
*/
private function checkNonce(Client $client, Token $token, $nonce, $timestamp)
{

View File

@ -5,11 +5,11 @@
* @package OAuth
* @author Andy Smith
* @author Gary Jones <gary@garyjones.co.uk>
* @license https://raw.github.com/GaryJones/OAuth/master/LICENSE MIT
* @link https://github.com/GaryJones/OAuth
* @license https://raw.github.com/jacobkiers/OAuth/master/LICENSE MIT
* @link https://github.com/jacobkiers/OAuth
*/
namespace GaryJones\OAuth;
namespace JacobKiers\OAuth;
/**
* A class for implementing a Signature Method.
@ -36,9 +36,9 @@ abstract class SignatureMethod
* the encoding is handled in OAuthRequest when the final
* request is serialized.
*
* @param GaryJones\OAuth\Request $request
* @param GaryJones\OAuth\Client $client
* @param GaryJones\OAuth\Token $token
* @param JacobKiers\OAuth\Request $request
* @param JacobKiers\OAuth\Client $client
* @param JacobKiers\OAuth\Token $token
*
* @return string
*/
@ -47,8 +47,8 @@ abstract class SignatureMethod
/**
* Get the signature key, made up of client and optionally token shared secrets.
*
* @param GaryJones\OAuth\Client $client
* @param GaryJones\OAuth\Token $token
* @param JacobKiers\OAuth\Client $client
* @param JacobKiers\OAuth\Token $token
*
* @return string
*/
@ -66,9 +66,9 @@ abstract class SignatureMethod
/**
* Verifies that a given signature is correct.
*
* @param GaryJones\OAuth\Request $request
* @param GaryJones\OAuth\Consumer $client
* @param GaryJones\OAuth\Token $token
* @param JacobKiers\OAuth\Request $request
* @param JacobKiers\OAuth\Consumer $client
* @param JacobKiers\OAuth\Token $token
* @param string $signature
*
* @return bool

View File

@ -5,11 +5,11 @@
* @package OAuth
* @author Andy Smith
* @author Gary Jones <gary@garyjones.co.uk>
* @license https://raw.github.com/GaryJones/OAuth/master/LICENSE MIT
* @link https://github.com/GaryJones/OAuth
* @license https://raw.github.com/jacobkiers/OAuth/master/LICENSE MIT
* @link https://github.com/jacobkiers/OAuth
*/
namespace GaryJones\OAuth;
namespace JacobKiers\OAuth;
/**
* Token holds the properties of a single token.

View File

@ -5,11 +5,11 @@
* @package OAuth
* @author Andy Smith
* @author Gary Jones <gary@garyjones.co.uk>
* @license https://raw.github.com/GaryJones/OAuth/master/LICENSE MIT
* @link https://github.com/GaryJones/OAuth
* @license https://raw.github.com/jacobkiers/OAuth/master/LICENSE MIT
* @link https://github.com/jacobkiers/OAuth
*/
namespace GaryJones\OAuth;
namespace JacobKiers\OAuth;
/**
* Group of static utility methods.
@ -29,7 +29,7 @@ class Util
public static function urlencodeRfc3986($input)
{
if (is_array($input)) {
return array_map(array('GaryJones\OAuth\Util', 'urlencodeRfc3986'), $input);
return array_map(array('JacobKiers\OAuth\Util', 'urlencodeRfc3986'), $input);
} elseif (is_scalar($input)) {
return str_replace('+', ' ', str_replace('%7E', '~', rawurlencode($input)));
} else {

View File

@ -1,6 +1,6 @@
<?php
use GaryJones\OAuth\Client;
use JacobKiers\OAuth\Client;
class ClientTest extends PHPUnit_Framework_TestCase
{

View File

@ -1,7 +1,7 @@
<?php
use Mockery as m;
use GaryJones\OAuth\HmacSha1;
use JacobKiers\OAuth\HmacSha1;
class HmacSha1Test extends PHPUnit_Framework_TestCase
{
@ -56,7 +56,7 @@ class HmacSha1Test extends PHPUnit_Framework_TestCase
private function getRequest()
{
return m::mock('GaryJones\OAuth\Request', function ($mock) {
return m::mock('JacobKiers\OAuth\Request', function ($mock) {
$mock->shouldReceive('getSignatureBaseString')
->withNoArgs()
->andReturn('POST&http%3A%2F%2Fexample.com%2Ffoobar&oauth_signature_method%3DHMAC-SHA1')->once();
@ -65,14 +65,14 @@ class HmacSha1Test extends PHPUnit_Framework_TestCase
private function getClient()
{
return m::mock('GaryJones\OAuth\Client', function ($mock) {
return m::mock('JacobKiers\OAuth\Client', function ($mock) {
$mock->shouldReceive('getSecret')->withNoArgs()->andReturn('secret')->once();
});
}
private function getToken()
{
return m::mock('GaryJones\OAuth\Token', function ($mock) {
return m::mock('JacobKiers\OAuth\Token', function ($mock) {
$mock->shouldReceive('getSecret')->withNoArgs()->andReturn('token_secret');
});
}

View File

@ -1,7 +1,7 @@
<?php
use Mockery as m;
use GaryJones\OAuth\PlainText;
use JacobKiers\OAuth\PlainText;
class PlainTextTest extends PHPUnit_Framework_TestCase
{
@ -56,19 +56,19 @@ class PlainTextTest extends PHPUnit_Framework_TestCase
private function getRequest()
{
return m::mock('GaryJones\OAuth\Request');
return m::mock('JacobKiers\OAuth\Request');
}
private function getClient()
{
return m::mock('GaryJones\OAuth\Client', function ($mock) {
return m::mock('JacobKiers\OAuth\Client', function ($mock) {
$mock->shouldReceive('getSecret')->withNoArgs()->andReturn('secret')->once();
});
}
private function getToken()
{
return m::mock('GaryJones\OAuth\Token', function ($mock) {
return m::mock('JacobKiers\OAuth\Token', function ($mock) {
$mock->shouldReceive('getSecret')->withNoArgs()->andReturn('token_secret');
});
}

View File

@ -1,7 +1,7 @@
<?php
use Mockery as m;
use GaryJones\OAuth\Request;
use JacobKiers\OAuth\Request;
class RequestTest extends PHPUnit_Framework_TestCase
{

View File

@ -1,7 +1,7 @@
<?php
use Mockery as m;
use GaryJones\OAuth\SignatureMethod;
use JacobKiers\OAuth\SignatureMethod;
/**
* Create concrete class from abstract SignatureMethod.
@ -14,9 +14,9 @@ class FooBarSignatureMethod extends SignatureMethod
}
public function buildSignature(
\GaryJones\OAuth\Request $request,
\GaryJones\OAuth\Client $client,
\GaryJones\OAuth\Token $token = null
\JacobKiers\OAuth\Request $request,
\JacobKiers\OAuth\Client $client,
\JacobKiers\OAuth\Token $token = null
) {
}
}
@ -66,14 +66,14 @@ class SignatureTest extends PHPUnit_Framework_TestCase
private function getClient()
{
return m::mock('GaryJones\OAuth\Client', function ($mock) {
return m::mock('JacobKiers\OAuth\Client', function ($mock) {
$mock->shouldReceive('getSecret')->withNoArgs()->andReturn('secret')->once();
});
}
private function getToken()
{
return m::mock('GaryJones\OAuth\Token', function ($mock) {
return m::mock('JacobKiers\OAuth\Token', function ($mock) {
$mock->shouldReceive('getSecret')->withNoArgs()->andReturn('token_secret');
});
}

View File

@ -1,8 +1,8 @@
<?php
use GaryJones\OAuth\Token;
use GaryJones\OAuth\NullToken;
use GaryJones\OAuth\Util;
use JacobKiers\OAuth\Token;
use JacobKiers\OAuth\NullToken;
use JacobKiers\OAuth\Util;
class TokenTest extends PHPUnit_Framework_TestCase
{