2 namespace PayPal\Auth\Oauth;
4 * A class for implementing a Signature Method
5 * See section 9 ("Signing Requests") in the spec
7 abstract class OAuthSignatureMethod {
9 * Needs to return the name of the Signature Method (ie HMAC-SHA1)
12 abstract public function get_name();
15 * Build up the signature
16 * NOTE: The output of this function MUST NOT be urlencoded.
17 * the encoding is handled in OAuthRequest when the final
18 * request is serialized
19 * @param OAuthRequest $request
20 * @param OAuthConsumer $consumer
21 * @param OAuthToken $token
24 abstract public function build_signature($request, $consumer, $token);
27 * Verifies that a given signature is correct
28 * @param OAuthRequest $request
29 * @param OAuthConsumer $consumer
30 * @param OAuthToken $token
31 * @param string $signature
34 public function check_signature($request, $consumer, $token, $signature) {
35 $built = $this->build_signature($request, $consumer, $token);
36 return $built == $signature;