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 @@ class HmacSha1 extends SignatureMethod
* 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 @@ class PlainText extends SignatureMethod
* 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 @@ class Request implements RequestInterface
* @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 @@ class Request implements RequestInterface
* @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 class RsaSha1 extends SignatureMethod
/**
* 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 @@ abstract class RsaSha1 extends SignatureMethod
/**
* 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 @@ class Server
*
* Returns the request token on success
*
* @param JacobKiers\OAuth\RequestInterface $request
* @param JacobKiers\OAuth\RequestInterfaceInterface $request
*
* @return JacobKiers\OAuth\Token
*/
@ -103,7 +103,7 @@ class Server
*
* Returns the access token on success.
*
* @param JacobKiers\OAuth\RequestInterface $request
* @param JacobKiers\OAuth\RequestInterfaceInterface $request
*
* @return JacobKiers\OAuth\Token
*/
@ -127,7 +127,7 @@ class Server
/**
* 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 @@ class Server
/**
* Check that version is 1.0.
*
* @param JacobKiers\OAuth\RequestInterface $request
* @param JacobKiers\OAuth\RequestInterfaceInterface $request
*
* @return string
*
@ -168,7 +168,7 @@ class Server
/**
* 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 @@ class Server
/**
* 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 @@ class Server
/**
* 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 @@ class Server
*
* 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 class SignatureMethod
* 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 @@ abstract class SignatureMethod
/**
* 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;