Exemplo n.º 1
0
 public function testGetRequestSchemeQueryStringClientSetsCorrectlyEncodedQueryString()
 {
     $request = new Http\RequestToken($this->stubConsumer, null, $this->stubHttpUtility);
     $params = array('oauth_consumer_key' => '1234567890', 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', 'oauth_signature_method' => 'HMAC-SHA1', 'oauth_timestamp' => '12345678901', 'oauth_version' => '1.0', 'oauth_callback_url' => 'http://www.example.com/local', 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c', 'custom_param1' => 'foo', 'custom_param2' => 'bar');
     $client = $request->getRequestSchemeQueryStringClient($params, 'http://www.example.com');
     $this->assertEquals('oauth_consumer_key=1234567890&oauth_nonce=e807f1fcf82d132f9bb018c' . 'a6738a19f&oauth_signature_method=HMAC-SHA1&oauth_timestamp=12345' . '678901&oauth_version=1.0&oauth_callback_url=http%3A%2F%2Fwww.example.com%2Flocal' . '&oauth_signature=6fb42da0e32e07b61c9f0251fe627a9c' . '&custom_param1=foo&custom_param2=bar', $client->getUri()->getQuery());
 }
Exemplo n.º 2
0
 /**
  * Attempts to retrieve a Request Token from an OAuth Provider which is
  * later exchanged for an authorized Access Token used to access the
  * protected resources exposed by a web service API.
  *
  * @param  null|array $customServiceParameters Non-OAuth Provider-specified parameters
  * @param  null|string $httpMethod
  * @param  null|ZendOAuth\Http\RequestToken $request
  * @return ZendOAuth\Token\Request
  */
 public function getRequestToken(array $customServiceParameters = null, $httpMethod = null, Http\RequestToken $request = null)
 {
     if ($request === null) {
         $request = new Http\RequestToken($this, $customServiceParameters);
     } elseif ($customServiceParameters !== null) {
         $request->setParameters($customServiceParameters);
     }
     if ($httpMethod !== null) {
         $request->setMethod($httpMethod);
     } else {
         $request->setMethod($this->getRequestMethod());
     }
     $this->_requestToken = $request->execute();
     return $this->_requestToken;
 }