You are here

OAuthSignatureMethod.php in jQuery social stream 8.2

Same filename and directory in other branches
  1. 8 src/Twitter/OAuthSignatureMethod.php

File

src/Twitter/OAuthSignatureMethod.php
View source
<?php

namespace Drupal\jquery_social_stream\Twitter;


/**
 * A class for implementing a Signature Method
 * See section 9 ("Signing Requests") in the spec
 */
abstract class OAuthSignatureMethod {

  /**
   * Needs to return the name of the Signature Method (ie HMAC-SHA1)
   * @return string
   */
  public abstract function get_name();

  /**
   * Build up the signature
   * NOTE: The output of this function MUST NOT be urlencoded.
   * the encoding is handled in OAuthRequest when the final
   * request is serialized
   * @param OAuthRequest $request
   * @param OAuthConsumer $consumer
   * @param OAuthToken $token
   * @return string
   */
  public abstract function build_signature($request, $consumer, $token);

  /**
   * Verifies that a given signature is correct
   * @param OAuthRequest $request
   * @param OAuthConsumer $consumer
   * @param OAuthToken $token
   * @param string $signature
   * @return bool
   */
  public function check_signature($request, $consumer, $token, $signature) {
    $built = $this
      ->build_signature($request, $consumer, $token);
    return $built == $signature;
  }

}

Classes

Namesort descending Description
OAuthSignatureMethod A class for implementing a Signature Method See section 9 ("Signing Requests") in the spec