/** * @group ZF-10182 */ public function testOauthClientPassingArrayInConstructor() { $options = array('requestMethod' => 'GET', 'siteUrl' => 'http://www.example.com'); $client = new OAuth\Client($options); $this->assertEquals('GET', $client->getRequestMethod()); $this->assertEquals('http://www.example.com', $client->getSiteUrl()); }
/** * Constructor * * @param null|Zend\Http\Response $response * @param null|Zend\OAuth\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; } }
/** * Get OAuth client * * @param array $oauthOptions * @param null|string $uri * @param null|array|Zend\Config\Config $config * @param bool $excludeCustomParamsFromHeader * @return Zend\OAuth\Client */ public function getHttpClient(array $oauthOptions, $uri = null, $config = null, $excludeCustomParamsFromHeader = true) { $client = new OAuth\Client($oauthOptions, $uri, $config, $excludeCustomParamsFromHeader); $client->setToken($this); return $client; }
public function testOauthClientUsingPostAndGetRequestParametersForSignature() { $mock = $this->getMock('Zend\\OAuth\\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 OAuth\Token\Access(null, $mock); $token->setToken('123')->setTokenSecret('456'); $client = new OAuth\Client(array('token' => $token), 'http://www.example.com'); $client->getRequest()->getPost()->set('foo', 'bar'); $client->getRequest()->getQuery()->set('baz', 'bat'); $client->prepareOAuth(); $header = 'OAuth realm="",oauth_consumer_key="",oauth_nonce="67648c83ba9a7de429bd1b773fb96091",oauth_signature_method="HMAC-SHA1",oauth_timestamp="123456789",oauth_version="1.0",oauth_token="123",oauth_signature="qj3FYtStzP083hT9QkqCdxsMauw%3D"'; $this->assertEquals($header, $client->getHeader('Authorization')); }