public function testSiteUrlArePropertlyBuiltFromDefaultPaths()
 {
     $config = new StandardConfig(array('siteUrl' => 'https://example.com/oauth/'));
     $this->assertEquals('https://example.com/oauth/authorize', $config->getAuthorizeUrl());
     $this->assertEquals('https://example.com/oauth/request_token', $config->getRequestTokenUrl());
     $this->assertEquals('https://example.com/oauth/access_token', $config->getAccessTokenUrl());
 }
Example #2
0
 /**
  * Constructor; creates a new HTTP Client instance which itself is
  * just a typical Zend_HTTP_Client subclass with some OAuth icing to
  * assist in automating OAuth parameter generation, addition and
  * cryptographic signing of requests.
  *
  * @param  array|Traversable $oauthOptions
  * @param  string $uri
  * @param  array|Traversable $options
  */
 public function __construct($oauthOptions, $uri = null, $config = null)
 {
     parent::__construct($uri, $config);
     $this->_config = new Config\StandardConfig();
     if ($oauthOptions !== null) {
         if ($oauthOptions instanceof Traversable) {
             $oauthOptions = ArrayUtils::iteratorToArray($oauthOptions);
         }
         $this->_config->setOptions($oauthOptions);
     }
 }
Example #3
0
 /**
  * Parse option array and setup options using their
  * relevant mutators.
  *
  * @param  array $options
  * @return StandardConfig
  */
 public function setOptions(array $options)
 {
     parent::setOptions($options);
     foreach ($options as $key => $value) {
         switch ($key) {
             //New in oauth2.0
             case 'code':
                 $this->setCode($value);
                 break;
             case 'scope':
                 $this->setScope($value);
                 break;
             case 'responseType':
                 $this->setResponseType($value);
                 break;
             case 'accessTokenFormat':
                 $this->setAccessTokenFormat($value);
                 break;
                 //New in oauth2.0 end
         }
     }
     return $this;
 }