Also use RequestInterface in Signature Methods.

This commit is contained in:
Jacob Kiers
2013-02-08 15:26:42 +00:00
parent e8edc17196
commit 646e466639
6 changed files with 22 additions and 22 deletions

View File

@@ -46,13 +46,13 @@ public function getName()
* Please note that the second encoding MUST NOT happen in the SignatureMethod, as
* OAuthRequest handles this!
*
* @param JacobKiers\OAuth\Request $request
* @param JacobKiers\OAuth\RequestInterface $request
* @param JacobKiers\OAuth\Client $client
* @param JacobKiers\OAuth\Token $token
*
* @return string
*/
public function buildSignature(Request $request, Client $client, Token $token = null)
public function buildSignature(RequestInterface $request, Client $client, Token $token = null)
{
$base_string = $request->getOAuthSignatureBaseString();
$key = $this->getSignatureKey($client, $token);

View File

@@ -44,13 +44,13 @@ public function getName()
* Please note that the second encoding MUST NOT happen in the SignatureMethod, as
* OAuthRequest handles this!
*
* @param JacobKiers\OAuth\Request $request
* @param JacobKiers\OAuth\RequestInterface $request
* @param JacobKiers\OAuth\Client $client
* @param JacobKiers\OAuth\Token $token
*
* @return string
*/
public function buildSignature(Request $request, Client $client, Token $token = null)
public function buildSignature(RequestInterface $request, Client $client, Token $token = null)
{
return $this->getSignatureKey($client, $token);
}

View File

@@ -79,7 +79,7 @@ public function __construct($http_method, $http_url, array $parameters = null)
* @param string $http_url Request URL.
* @param array $parameters HTTP parameters.
*
* @return JacobKiers\OAuth\Request
* @return JacobKiers\OAuth\RequestInterface
*/
public static function fromRequest($http_method = null, $http_url = null, $parameters = null)
{
@@ -137,7 +137,7 @@ public static function fromRequest($http_method = null, $http_url = null, $param
* @param string $http_url
* @param array $parameters
*
* @return JacobKiers\OAuth\Request
* @return JacobKiers\OAuth\RequestInterface
*/
public static function fromClientAndToken(
Client $client,

View File

@@ -58,13 +58,13 @@ abstract protected function fetchPrivateCert(&$request);
/**
* Build up the signature.
*
* @param JacobKiers\OAuth\Request $request
* @param JacobKiers\OAuth\RequestInterface $request
* @param JacobKiers\OAuth\Client $client
* @param JacobKiers\OAuth\Token $token
*
* @return string
*/
public function buildSignature(Request $request, Client $client, Token $token = null)
public function buildSignature(RequestInterface $request, Client $client, Token $token = null)
{
$base_string = $request->getOAuthSignatureBaseString();
@@ -86,14 +86,14 @@ public function buildSignature(Request $request, Client $client, Token $token =
/**
* Verifies that a given signature is correct.
*
* @param JacobKiers\OAuth\Request $request
* @param JacobKiers\OAuth\RequestInterface $request
* @param JacobKiers\OAuth\Consumer $client
* @param JacobKiers\OAuth\Token $token
* @param string $signature
*
* @return bool
*/
public function checkSignature(Request $request, Client $client, Token $token, $signature)
public function checkSignature(RequestInterface $request, Client $client, Token $token, $signature)
{
$base_string = $request->getOAuthSignatureBaseString();

View File

@@ -77,7 +77,7 @@ public function addSignatureMethod(SignatureMethod $signature_method)
*
* Returns the request token on success
*
* @param JacobKiers\OAuth\RequestInterface $request
* @param JacobKiers\OAuth\RequestInterfaceInterface $request
*
* @return JacobKiers\OAuth\Token
*/
@@ -103,7 +103,7 @@ public function fetchRequestToken(RequestInterface &$request)
*
* Returns the access token on success.
*
* @param JacobKiers\OAuth\RequestInterface $request
* @param JacobKiers\OAuth\RequestInterfaceInterface $request
*
* @return JacobKiers\OAuth\Token
*/
@@ -127,7 +127,7 @@ public function fetchAccessToken(RequestInterface &$request)
/**
* Verify an api call, checks all the parameters.
*
* @param JacobKiers\OAuth\RequestInterface $request
* @param JacobKiers\OAuth\RequestInterfaceInterface $request
*
* @return array Client and Token
*/
@@ -145,7 +145,7 @@ public function verifyRequest(RequestInterface &$request)
/**
* Check that version is 1.0.
*
* @param JacobKiers\OAuth\RequestInterface $request
* @param JacobKiers\OAuth\RequestInterfaceInterface $request
*
* @return string
*
@@ -168,7 +168,7 @@ private function getVersion(RequestInterface &$request)
/**
* Get the signature method name, and if it is supported.
*
* @param JacobKiers\OAuth\RequestInterface $request
* @param JacobKiers\OAuth\RequestInterfaceInterface $request
*
* @return string Signature method name.
*
@@ -196,7 +196,7 @@ private function getSignatureMethod(RequestInterface $request)
/**
* Try to find the client for the provided request's client key.
*
* @param JacobKiers\OAuth\RequestInterface $request
* @param JacobKiers\OAuth\RequestInterfaceInterface $request
*
* @return JacobKiers\OAuth\Client
*
@@ -221,7 +221,7 @@ private function getClient(RequestInterface $request)
/**
* Try to find the token for the provided request's token key.
*
* @param JacobKiers\OAuth\RequestInterface $request
* @param JacobKiers\OAuth\RequestInterfaceInterface $request
* @param JacobKiers\OAuth\Client $client
* @param string $token_type
*
@@ -245,7 +245,7 @@ private function getToken(RequestInterface $request, Client $client, $token_type
*
* Should determine the signature method appropriately
*
* @param JacobKiers\OAuth\RequestInterface $request
* @param JacobKiers\OAuth\RequestInterfaceInterface $request
* @param JacobKiers\OAuth\Client $client
* @param JacobKiers\OAuth\Token $token
*

View File

@@ -36,13 +36,13 @@ abstract public function getName();
* the encoding is handled in OAuthRequest when the final
* request is serialized.
*
* @param JacobKiers\OAuth\Request $request
* @param JacobKiers\OAuth\RequestInterface $request
* @param JacobKiers\OAuth\Client $client
* @param JacobKiers\OAuth\Token $token
*
* @return string
*/
abstract public function buildSignature(Request $request, Client $client, Token $token = null);
abstract public function buildSignature(RequestInterface $request, Client $client, Token $token = null);
/**
* Get the signature key, made up of client and optionally token shared secrets.
@@ -66,14 +66,14 @@ public function getSignatureKey(Client $client, Token $token = null)
/**
* Verifies that a given signature is correct.
*
* @param JacobKiers\OAuth\Request $request
* @param JacobKiers\OAuth\RequestInterface $request
* @param JacobKiers\OAuth\Consumer $client
* @param JacobKiers\OAuth\Token $token
* @param string $signature
*
* @return bool
*/
public function checkSignature(Request $request, Client $client, Token $token, $signature)
public function checkSignature(RequestInterface $request, Client $client, Token $token, $signature)
{
$built = $this->buildSignature($request, $client, $token);
return $built == $signature;