Example #1
0
 /**
  * Constructor
  *
  * @param null|Zend\Http\Response $response
  * @param null|ZendOAuth\Http\Utility $utility
  */
 public function __construct(HTTPResponse $response = null, HTTPUtility $utility = null)
 {
     parent::__construct($response, $utility);
     // detect if server supports OAuth 1.0a
     if (isset($this->_params[AbstractToken::TOKEN_PARAM_CALLBACK_CONFIRMED])) {
         Client::$supportsRevisionA = true;
     }
 }
Example #2
0
 public function testOAuthClientDoesntOverrideExistingHeaders()
 {
     $mock = $this->getMock('ZendOAuth\\Http\\Utility', array('generateTimestamp', 'generateNonce'));
     $mock->expects($this->once())->method('generateTimestamp')->will($this->returnValue('123456789'));
     $mock->expects($this->once())->method('generateNonce')->will($this->returnValue('67648c83ba9a7de429bd1b773fb96091'));
     $token = new Token\Access(null, $mock);
     $token->setToken('123')->setTokenSecret('456');
     $client = new OAuthClient(array('token' => $token), 'http://www.example.com');
     $dummyHeader = Header\ContentType::fromString('Content-Type: application/octet-stream');
     $headers = $client->getRequest()->getHeaders();
     $headers->addHeaders(array($dummyHeader));
     $client->prepareOAuth();
     $this->assertTrue($client->getRequest()->getHeaders()->has('Content-Type'));
     $this->assertEquals($dummyHeader, $client->getRequest()->getHeaders()->get('Content-Type'));
 }
Example #3
0
 /**
  * Get OAuth client
  *
  * @param  array $oauthOptions
  * @param  null|string $uri
  * @param  null|array|\Traversable $config
  * @param  bool $excludeCustomParamsFromHeader
  * @return Client
  */
 public function getHttpClient(array $oauthOptions, $uri = null, $config = null, $excludeCustomParamsFromHeader = true)
 {
     $client = new Client($oauthOptions, $uri, $config, $excludeCustomParamsFromHeader);
     $client->setToken($this);
     return $client;
 }