You are here

function OAuthRequest::calculateSignature in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.2 lib/oauth-php/library/OAuthRequest.php \OAuthRequest::calculateSignature()

* Calculate the signature of the request, using the method in oauth_signature_method. * The signature is returned encoded in the form as used in the url. So the base64 and * urlencoding has been done. * *

Parameters

string consumer_secret: * @param string token_secret * @param string token_type * @exception when not all parts available * @return string

1 call to OAuthRequest::calculateSignature()
OAuthRequestSigner::sign in lib/oauth-php/library/OAuthRequestSigner.php
* Sign our message in the way the server understands. * Set the needed oauth_xxxx parameters. * *

File

lib/oauth-php/library/OAuthRequest.php, line 178

Class

OAuthRequest
Object to parse an incoming OAuth request or prepare an outgoing OAuth request

Code

function calculateSignature($consumer_secret, $token_secret, $token_type = 'access') {
  $required = array(
    'oauth_consumer_key',
    'oauth_signature_method',
    'oauth_timestamp',
    'oauth_nonce',
  );
  if ($token_type != 'requestToken') {
    $required[] = 'oauth_token';
  }
  foreach ($required as $req) {
    if (!isset($this->param[$req])) {
      throw new OAuthException2('Can\'t sign request, missing parameter "' . $req . '"');
    }
  }
  $this
    ->checks();
  $base = $this
    ->signatureBaseString();
  $signature = $this
    ->calculateDataSignature($base, $consumer_secret, $token_secret, $this->param['oauth_signature_method']);
  return $signature;
}