當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Provider\AbstractProvider類代碼示例

本文整理匯總了PHP中League\OAuth2\Client\Provider\AbstractProvider的典型用法代碼示例。如果您正苦於以下問題:PHP AbstractProvider類的具體用法?PHP AbstractProvider怎麽用?PHP AbstractProvider使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了AbstractProvider類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: moveToAuth

 private function moveToAuth(AbstractProvider $provider)
 {
     $authorizationUrl = $provider->getAuthorizationUrl();
     $_SESSION['oauth2state'] = $provider->getState();
     header('Location: ' . $authorizationUrl);
     exit;
 }
開發者ID:cass-project,項目名稱:cass,代碼行數:7,代碼來源:AbstractCommand.php

示例2: makeRegistrationRequest

 protected function makeRegistrationRequest(AbstractProvider $provider, AccessToken $accessToken) : RegistrationRequest
 {
     /** @var GoogleUser $resourceOwner */
     $resourceOwner = $provider->getResourceOwner($accessToken);
     $email = $resourceOwner->getEmail();
     $providerAccountId = (string) $resourceOwner->getId();
     return new RegistrationRequest('google', $providerAccountId, $email, $resourceOwner);
 }
開發者ID:cass-project,項目名稱:cass,代碼行數:8,代碼來源:GoogleCommand.php

示例3: afterGetAccessToken

 /**
  * @param AbstractProvider $provider
  * @param AccessToken $token
  * @param string $providerName
  * @param SS_HTTPRequest $request
  */
 public function afterGetAccessToken(AbstractProvider $provider, AccessToken $token, $providerName, SS_HTTPRequest $request)
 {
     $user = $provider->getResourceOwner($token);
     try {
         $member = $this->memberFromResourceOwner($user, $providerName);
         $this->owner->setMember($member);
     } catch (TokenlessUserExistsException $e) {
         return Security::permissionFailure($this->owner, $e->getMessage());
     }
     $result = $member->canLogIn();
     if (!$result->valid()) {
         return Security::permissionFailure($this->owner, $result->message());
     }
     $member->logIn();
 }
開發者ID:bigfork,項目名稱:silverstripe-oauth-login,代碼行數:21,代碼來源:ControllerExtension.php

示例4: authenticate

 /**
  * {@inheritdoc}
  */
 public function authenticate(RequestInterface $request)
 {
     // TODO: add error handling
     // TODO: support other grant types?
     $accessToken = $this->provider->getAccessToken('client_credentials');
     return $request->withHeader('Authorization', 'Bearer ' . $accessToken);
 }
開發者ID:godmodelabs,項目名稱:flora-client-php-auth,代碼行數:10,代碼來源:OAuth2.php

示例5: testSetRedirectHandler

 public function testSetRedirectHandler()
 {
     $this->testFunction = false;
     $callback = function ($url) {
         $this->testFunction = $url;
     };
     $this->provider->setRedirectHandler($callback);
     $this->provider->authorize('http://test.url/');
     $this->assertNotFalse($this->testFunction);
 }
開發者ID:codeforamerica,項目名稱:oakland-beta,代碼行數:10,代碼來源:AbstractProviderTest.php

示例6: __construct

 /**
  * Constructs an OAuth 2.0 service provider.
  *
  * @param array $options An array of options to set on this provider.
  *     Options include `clientId`, `clientSecret`, `redirectUri`, and `state`.
  *     Individual providers may introduce more options, as needed.
  * @param array $collaborators An array of collaborators that may be used to
  *     override this provider's default behavior. Collaborators include
  *     `grantFactory`, `requestFactory`, `httpClient`, and `randomFactory`.
  *     Individual providers may introduce more collaborators, as needed.
  */
 public function __construct(array $options = [], array $collaborators = [])
 {
     parent::__construct($options, $collaborators);
     if ($this->token) {
         $this->token = new ModulbankAccessToken(['accessToken' => $this->token]);
     }
 }
開發者ID:slowprog,項目名稱:oauth2-modulbank,代碼行數:18,代碼來源:Modulbank.php

示例7: prepareAccessTokenResponse

 /**
  * Prepares an parsed access token response for a grant.
  *
  * Custom mapping of expiration, etc should be done here. Always call the
  * parent method when overloading this method.
  *
  * @param  mixed $result
  * @return array
  */
 protected function prepareAccessTokenResponse(array $result)
 {
     if (isset($result['data'])) {
         $result = $result['data'];
     }
     return parent::prepareAccessTokenResponse($result);
 }
開發者ID:stevenmaguire,項目名稱:oauth2-elance,代碼行數:16,代碼來源:Elance.php

示例8: getAccessToken

 public function getAccessToken($grant, array $options = [])
 {
     if ($this->authWithResource) {
         $options['resource'] = $this->resource ? $this->resource : $this->urlAPI;
     }
     return parent::getAccessToken($grant, $options);
 }
開發者ID:thenetworg,項目名稱:oauth2-azure,代碼行數:7,代碼來源:Azure.php

示例9: __construct

 /**
  * Provider constructor.
  * @param array $options
  */
 public function __construct(array $options = array())
 {
     parent::__construct($options);
     if (isset($options['sandbox']) && $options['sandbox']) {
         $this->baseURL = 'https://api.sandbox.freeagent.com/v2/';
     }
 }
開發者ID:6by6,項目名稱:freeagent-php,代碼行數:11,代碼來源:Provider.php

示例10: __construct

 public function __construct($options = [])
 {
     if (!array_has($options, 'redirectUri')) {
         $options['redirectUri'] = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
     }
     parent::__construct($options);
 }
開發者ID:eds,項目名稱:oauth-client,代碼行數:7,代碼來源:QQ.php

示例11: __construct

 /**
  * Constructs an OAuth 2.0 service provider.
  *
  * @param array $options An array of options to set on this provider.
  *     Options include `clientId`, `clientSecret`, `redirectUri`, and `state`.
  *     Individual providers may introduce more options, as needed.
  * @param array $collaborators An array of collaborators that may be used to
  *     override this provider's default behavior. Collaborators include
  *     `grantFactory`, `requestFactory`, `httpClient`, and `randomFactory`.
  *     Individual providers may introduce more collaborators, as needed.
  */
 public function __construct(array $options = [], array $collaborators = [])
 {
     parent::__construct($options, $collaborators);
     if (empty($this->subdomain)) {
         throw new Exception\ProviderConfigurationException('No subdomain has been configured for this Zendesk provider; it has to have a subdomain.');
     }
 }
開發者ID:stevenmaguire,項目名稱:oauth2-zendesk,代碼行數:18,代碼來源:Zendesk.php

示例12: getAccessToken

 /**
  * @param $grant
  * @param array $params
  */
 public function getAccessToken($grant = 'authorization_code', array $params = [])
 {
     if (isset($params['refresh_token'])) {
         throw new LightspeedProviderException('Lightspeed does not support token refreshing.');
     }
     return parent::getAccessToken($grant, $params);
 }
開發者ID:ursuleacv,項目名稱:oauth2-lightspeed,代碼行數:11,代碼來源:Lightspeed.php

示例13: __construct

 /**
  * Gitlab constructor.
  *
  * @param array $options
  * @param array $collaborators
  */
 public function __construct(array $options, array $collaborators = [])
 {
     if (isset($options['domain'])) {
         $this->domain = $options['domain'];
     }
     parent::__construct($options, $collaborators);
 }
開發者ID:omines,項目名稱:oauth2-gitlab,代碼行數:13,代碼來源:Gitlab.php

示例14: __construct

 public function __construct($options = [])
 {
     if (empty($options['domainPrefix'])) {
         throw new \RuntimeException('Vend provider requires a "domainPrefix" option');
     }
     parent::__construct($options);
 }
開發者ID:wheniwork,項目名稱:oauth2-vend,代碼行數:7,代碼來源:Vend.php

示例15: __construct

 /**
  * @param array $options
  * @param array $collaborators
  */
 public function __construct($options = [], array $collaborators = [])
 {
     parent::__construct($options);
     if (isset($options['devMode'])) {
         $this->setDevMode($options['devMode']);
     }
 }
開發者ID:tmannherz,項目名稱:oauth2-ringcentral,代碼行數:11,代碼來源:Ringcentral.php


注:本文中的League\OAuth2\Client\Provider\AbstractProvider類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。