You are here

function LingotekOAuthRequest::calculateSignature in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.4 lib/oauth-php/library/LingotekOAuthRequest.php \LingotekOAuthRequest::calculateSignature()
  2. 7.5 lib/oauth-php/library/LingotekOAuthRequest.php \LingotekOAuthRequest::calculateSignature()
  3. 7.6 lib/oauth-php/library/LingotekOAuthRequest.php \LingotekOAuthRequest::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 LingotekOAuthRequest::calculateSignature()
LingotekOAuthRequestSigner::sign in lib/oauth-php/library/LingotekOAuthRequestSigner.php
* Sign our message in the way the server understands. * Set the needed oauth_xxxx parameters. * *

File

lib/oauth-php/library/LingotekOAuthRequest.php, line 147

Class

LingotekOAuthRequest
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;
}