Beispiel #1
0
 /**
  * Get the signature key, made up of consumer and optionally token shared secrets.
  *
  * @param JacobKiers\OAuth\Consumer\ConsumerInterface    $consumer
  * @param JacobKiers\OAuth\Token\TokenInterface $token
  *
  * @return string
  */
 public function getSignatureKey(ConsumerInterface $consumer, TokenInterface $token = null)
 {
     $key_parts = array($consumer->getSecret(), $token ? $token->getSecret() : '');
     $key_parts = Util::urlencodeRfc3986($key_parts);
     return implode('&', $key_parts);
 }
 /**
  * Helper function to set up the request.
  *
  * @param JacobKiers\OAuth\Consumer\ConsumerInterface    $consumer
  * @param JacobKiers\OAuth\Token\TokenInterface $token
  * @param string                                $http_method
  * @param string                                $http_url
  * @param array                                 $parameters
  *
  * @return JacobKiers\OAuth\Request\RequestInterface
  */
 public static function fromConsumerAndToken(ConsumerInterface $consumer, TokenInterface $token, $http_method, $http_url, array $parameters = null)
 {
     $parameters = $parameters ? $parameters : array();
     $defaults = array('oauth_nonce' => Request::generateNonce(), 'oauth_timestamp' => Request::generateTimestamp(), 'oauth_consumer_key' => $consumer->getKey());
     if ($token->getKey()) {
         $defaults['oauth_token'] = $token->getKey();
     }
     $parameters = array_merge($defaults, $parameters);
     return new Request($http_method, $http_url, $parameters);
 }