コード例 #1
0
ファイル: DoYouBuzzAPI.php プロジェクト: doyoubuzz/api-helper
 protected function init($callbackUrl = null)
 {
     if (!$this->init) {
         if (!$this->storage) {
             $this->storage = new Session();
         }
         $uriFactory = new UriFactory();
         $this->currentUri = $uriFactory->createFromSuperGlobalArray($_SERVER);
         $credentials = new Credentials($this->apiKey, $this->apiSecret, $callbackUrl ? $callbackUrl : $this->currentUri->getAbsoluteUri());
         $serviceFactory = new ServiceFactory();
         $serviceFactory->setHttpClient(new CurlClient());
         $serviceFactory->registerService('DoYouBuzz', 'DoYouBuzz\\ApiHelper\\DoYouBuzzService');
         $this->service = $serviceFactory->createService('DoYouBuzz', $credentials, $this->storage);
         $this->init = true;
     }
 }
コード例 #2
0
ファイル: OAuth2.php プロジェクト: scharrier/li3_socialauth
 /**
  * Check the authentication. Will be called two times : first to request a token, and redirect
  * to the Twitter api url, then to authenticate the user.
  *
  * @param  [type] $request [description]
  * @param  array  $options [description]
  * @return [type]          [description]
  */
 public function check($request, array $options = array())
 {
     $here = new Uri($request->to('url'));
     $here->setQuery('');
     $credentials = new Credentials($this->_config['key'], $this->_config['secret'], $here->getAbsoluteUri());
     $serviceFactory = new ServiceFactory();
     $service = $serviceFactory->createService(static::NAME, $credentials, $this->_storage, $this->_config['scope']);
     if (empty($request->query['code'])) {
         $url = $service->getAuthorizationUri();
         header('Location: ' . $url);
         exit(0);
     } else {
         $service->requestAccessToken($request->query['code']);
         $result = json_decode($service->request(static::USER_INFO), true);
         return $result;
     }
 }
コード例 #3
0
 private function getServiceObject()
 {
     $oUrl = new Uri(BX_DOL_URL_STUDIO . 'store.php?page=purchases');
     $oCredentials = new Credentials($this->sKey, $this->sSecret, $oUrl->getAbsoluteUri());
     $oServiceFactory = new ServiceFactory();
     return $oServiceFactory->createService($this->sService, $oCredentials, $this->oStorage);
 }
コード例 #4
0
ファイル: UriTest.php プロジェクト: Flesh192/magento
 /**
  * @covers OAuth\Common\Http\Uri\Uri::__construct
  * @covers OAuth\Common\Http\Uri\Uri::parseUri
  * @covers OAuth\Common\Http\Uri\Uri::setHost
  * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri
  */
 public function testSetHost()
 {
     $uri = new Uri('http://example.com');
     $uri->setHost('pieterhordijk.com');
     $this->assertSame('http://pieterhordijk.com', $uri->getAbsoluteUri());
 }