コード例 #1
0
ファイル: Reddit.php プロジェクト: DevSlashNull/PHPoAuthLib
 public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
 {
     parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, true);
     if (null === $baseApiUri) {
         $this->baseApiUri = new Uri('https://oauth.reddit.com');
     }
 }
コード例 #2
0
ファイル: Twitch.php プロジェクト: freaktechnik/PHPoAuthLib
 public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null, $apiVersion = "v3")
 {
     parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, true, $apiVersion);
     if (null === $baseApiUri) {
         $this->baseApiUri = new Uri('https://api.twitch.tv/kraken/');
     }
 }
コード例 #3
0
 /**
  * Request access token
  *
  * This is the second step of oAuth authentication
  *
  * This implementation tries to abstract away differences between oAuth1 and oAuth2,
  * but might need to be overwritten for specific services
  *
  * @return bool
  */
 public function checkToken()
 {
     global $INPUT;
     if (is_a($this->oAuth, 'OAuth\\OAuth2\\Service\\AbstractService')) {
         /* oAuth2 handling */
         if (!$INPUT->get->has('code')) {
             return false;
         }
         $state = $INPUT->get->str('state', null);
         try {
             $this->oAuth->requestAccessToken($INPUT->get->str('code'), $state);
         } catch (TokenResponseException $e) {
             msg($e->getMessage(), -1);
             return false;
         }
     } else {
         /* oAuth1 handling */
         if (!$INPUT->get->has('oauth_token')) {
             return false;
         }
         $token = $this->storage->retrieveAccessToken($this->getServiceName());
         // This was a callback request from BitBucket, get the token
         try {
             $this->oAuth->requestAccessToken($INPUT->get->str('oauth_token'), $INPUT->get->str('oauth_verifier'), $token->getRequestTokenSecret());
         } catch (TokenResponseException $e) {
             msg($e->getMessage(), -1);
             return false;
         }
     }
     return true;
 }
コード例 #4
0
 public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
 {
     parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
     if ($baseApiUri === null) {
         $this->baseApiUri = new Uri(self::API_URI_US);
     }
 }
コード例 #5
0
ファイル: Pocket.php プロジェクト: DevSlashNull/PHPoAuthLib
 public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
 {
     parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
     if ($baseApiUri === null) {
         $this->baseApiUri = new Uri('https://getpocket.com/v3/');
     }
 }
コード例 #6
0
 public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
 {
     parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
     if (null === $baseApiUri) {
         $this->baseApiUri = new Uri('http://rest.bullhornstaffing.com/rest-services/');
     }
 }
コード例 #7
0
ファイル: NukeViet.php プロジェクト: vuthao/nukeviet-oauth2
 public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null, $apiVersion = "")
 {
     parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, false, $apiVersion);
     if (null === $baseApiUri) {
         $this->baseApiUri = new Uri('http://server.oauth2.nukeviet.vn/oauth2/resource');
     }
 }
コード例 #8
0
 public function __construct(Credentials $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
 {
     parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
     if (null === $baseApiUri) {
         $this->baseApiUri = new Uri(static::BASE_URL . 'resource/');
     }
 }
コード例 #9
0
 public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
 {
     parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
     if (null === $baseApiUri) {
         $this->baseApiUri = new Uri('http://aimalyzer:8080/api/1.0/');
     }
 }
コード例 #10
0
 public function __construct(\OAuth\Common\Consumer\CredentialsInterface $credentials, \OAuth\Common\Http\Client\ClientInterface $httpClient, \OAuth\Common\Storage\TokenStorageInterface $storage, $scopes = array(), \OAuth\Common\Http\Uri\UriInterface $baseApiUri = null)
 {
     parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
     if (null === $baseApiUri) {
         $this->baseApiUri = new Uri('https://www.readability.com/api/rest/v1/');
     }
 }
コード例 #11
0
ファイル: Mailchimp.php プロジェクト: vladvoth/productclash
 /**
  * {@inheritdoc}
  */
 public function request($path, $method = 'GET', $body = null, array $extraHeaders = array())
 {
     if (is_null($this->baseApiUri)) {
         $this->setBaseApiUri($this->storage->retrieveAccessToken($this->service()));
     }
     return parent::request($path, $method, $body, $extraHeaders);
 }
コード例 #12
0
ファイル: Paypal.php プロジェクト: Tarendai/spring-website
 public function __construct(Credentials $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
 {
     parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
     if (null === $baseApiUri) {
         $this->baseApiUri = new Uri('https://api.paypal.com/v1/');
     }
 }
コード例 #13
0
ファイル: Pinterest.php プロジェクト: artis-mosties/oauth-php
 public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = [], UriInterface $baseApiUri = null, $apiVersion = "")
 {
     parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, false, $apiVersion);
     $this->apiVersion = "v1";
     if (is_null($baseApiUri)) {
         $this->baseApiUri = new Uri(self::API_URL . $this->getApiVersionString());
     }
 }
コード例 #14
0
 public function __construct(Credentials $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
 {
     $scopes = array();
     parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
     if (null === $baseApiUri) {
         $this->baseApiUri = new Uri('https://sisilogin.testeveonline.com/oauth/');
     }
 }
コード例 #15
0
 public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
 {
     parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
     $hlp = plugin_load('helper', 'oauth');
     $this->domain = $hlp->getConf('auth0-domain');
     if (null === $baseApiUri) {
         $this->baseApiUri = new Uri("https://{$this->domain}/");
     }
 }
コード例 #16
0
ファイル: Strava.php プロジェクト: clee03/metal
 public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
 {
     if (empty($scopes)) {
         $scopes = array(self::SCOPE_PUBLIC);
     }
     parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, true);
     if (null === $baseApiUri) {
         $this->baseApiUri = new Uri('https://www.strava.com/api/v3/');
     }
 }
コード例 #17
0
ファイル: Mock.php プロジェクト: Flesh192/magento
 /**
  * Returns a class constant from ServiceInterface defining the authorization method used for the API
  * Header is the sane default.
  *
  * @return int
  */
 protected function getAuthorizationMethod()
 {
     switch ($this->authorizationMethod) {
         case 'querystring':
             return static::AUTHORIZATION_METHOD_QUERY_STRING;
         case 'querystring2':
             return static::AUTHORIZATION_METHOD_QUERY_STRING_V2;
         case 'bearer':
             return static::AUTHORIZATION_METHOD_HEADER_BEARER;
     }
     return parent::getAuthorizationMethod();
 }
コード例 #18
0
 /**
  * Request access token
  *
  * This is the second step of oAuth authentication
  *
  * This implementation tries to abstract away differences between oAuth1 and oAuth2,
  * but might need to be overwritten for specific services
  *
  * @return bool
  */
 public function checkToken()
 {
     global $INPUT;
     if (is_a($this->oAuth, 'OAuth\\OAuth2\\Service\\AbstractService')) {
         /* oAuth2 handling */
         if (!$INPUT->get->has('code')) {
             return false;
         }
         $state = $INPUT->get->str('state', null);
         try {
             $this->oAuth->requestAccessToken($INPUT->get->str('code'), $state);
         } catch (TokenResponseException $e) {
             msg($e->getMessage(), -1);
             return false;
         }
     } else {
         /* oAuth1 handling */
         if (!$INPUT->get->has('oauth_token')) {
             return false;
         }
         $token = $this->storage->retrieveAccessToken($this->getServiceName());
         // This was a callback request from BitBucket, get the token
         try {
             $this->oAuth->requestAccessToken($INPUT->get->str('oauth_token'), $INPUT->get->str('oauth_verifier'), $token->getRequestTokenSecret());
         } catch (TokenResponseException $e) {
             msg($e->getMessage(), -1);
             return false;
         }
     }
     $validDomains = $this->hlp->getValidDomains();
     if (count($validDomains) > 0) {
         $userData = $this->getUser();
         if (!$this->hlp->checkMail($userData['mail'])) {
             msg(sprintf($this->hlp->getLang("rejectedEMail"), join(', ', $validDomains)), -1);
             send_redirect(wl('', array('do' => 'login'), false, '&'));
         }
     }
     return true;
 }
コード例 #19
0
 /**
  * {@inheritdoc}
  */
 public function request($path, $method = 'GET', $body = null, array $extraHeaders = array())
 {
     $uri = $this->determineRequestUriFromPath($path, $this->baseApiUri);
     $uri->addToQuery('v', $this->apiVersionDate);
     return parent::request($uri, $method, $body, $extraHeaders);
 }
コード例 #20
0
ファイル: Intuit.php プロジェクト: raycho/PHPoAuthLib
 public function request($path, $method = 'GET', $body = null, array $extraHeaders = array())
 {
     $params = ['oauth_token' => 'qyprd3VVTi05a8Ukbv2DNO2Z2CP1CwflHHrGUiAOyPMQ1CTB', 'oauth_nonce' => $this->_nonce(), 'oauth_consumer_key' => $this->credentials->getConsumerId(), 'oauth_signature_method' => 'HMAC-SHA1', 'oauth_timestamp' => time(), 'oauth_version' => '1.0'];
     $responseBody = $this->httpClient->retrieveResponse(new Uri(\Config::get('intuit.url') . $path), $params, $extraHeaders);
     dd($responseBody);
     array_walk($params, function (&$val, &$key) {
         $key = strtolower($key);
         $val = strtolower($key) . '=' . $val;
     });
     return parent::request($path, $method, $body, $extraHeaders);
 }
コード例 #21
0
 /**
  * {@inheritdoc}
  */
 public function request($path, $method = 'GET', $body = null, array $extraHeaders = array())
 {
     $uri = new Uri($this->baseApiUri . $path);
     $uri->addToQuery('v', $this->apiVersionDate);
     return parent::request($uri, $method, $body, $extraHeaders);
 }
コード例 #22
0
ファイル: ServiceProxy.php プロジェクト: barbq/yii2eauth
 /**
  * @param CredentialsInterface $credentials
  * @param ClientInterface $httpClient
  * @param TokenStorageInterface $storage
  * @param array $scopes
  * @param UriInterface $baseApiUri
  * @param Service $service
  */
 public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null, Service $service)
 {
     $this->service = $service;
     parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, $service->getValidateState());
 }
コード例 #23
0
ファイル: Foursquare.php プロジェクト: nukeplus/nuke
 /**
  * {@inheritdoc}
  */
 public function request($path, array $body = [], $method = 'GET', array $extraHeaders = [])
 {
     $uri = $this->determineRequestUriFromPath($path);
     $uri->getQuery()->modify(['v' => $this->apiVersionDate]);
     return parent::request($uri, $body, $method, $extraHeaders);
 }
コード例 #24
0
ファイル: Google.php プロジェクト: nukeplus/nuke
 /**
  * {@inheritdoc}
  */
 public function getAuthorizationEndpoint()
 {
     $uri = parent::getAuthorizationEndpoint();
     $uri->getQuery()->modify(['access_type' => $this->accessType]);
     return $uri;
 }
コード例 #25
0
 public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null, $apiVersion = "")
 {
     parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, true, $apiVersion);
     if (null === $baseApiUri) {
         $this->baseApiUri = new Uri('https://graph.facebook.com' . $this->getApiVersionString() . '/');
     }
 }
コード例 #26
0
ファイル: ServiceProxy.php プロジェクト: fogunkoya/yii2-eauth
 /**
  * Retrieves and stores the OAuth2 access token after a successful authorization.
  *
  * @param string $code The access code from the callback.
  * @return TokenInterface $token
  * @throws TokenResponseException
  * @throws ErrorException
  * @throws InvalidStateException
  */
 public function requestAccessToken($code)
 {
     if (isset($this->state) && $this->service->getValidateState()) {
         if (!isset($_GET['state']) || !$this->state->validateId($_GET['state'])) {
             throw new InvalidStateException('The valid "state" argument required.');
         }
     }
     return parent::requestAccessToken($code);
 }
コード例 #27
0
ファイル: Reddit.php プロジェクト: nukeplus/nuke
 public function getAuthorizationUri(array $additionalParameters = [])
 {
     $state = uniqid();
     $this->storage->storeAuthorizationState($this->service(), $state);
     return parent::getAuthorizationUri(array_merge(['state' => $state], $additionalParameters));
 }
コード例 #28
0
 public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
 {
     parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
 }