当前位置: 首页>>代码示例>>PHP>>正文


PHP AbstractProvider::getResourceOwner方法代码示例

本文整理汇总了PHP中League\OAuth2\Client\Provider\AbstractProvider::getResourceOwner方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractProvider::getResourceOwner方法的具体用法?PHP AbstractProvider::getResourceOwner怎么用?PHP AbstractProvider::getResourceOwner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在League\OAuth2\Client\Provider\AbstractProvider的用法示例。


在下文中一共展示了AbstractProvider::getResourceOwner方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getResourceOwner

 /**
  * Query the provider for the resource owner.
  *
  * @param AccessToken $accessToken
  *
  * @throws IdentityProviderException
  *
  * @return ResourceOwnerInterface
  */
 protected function getResourceOwner(AccessToken $accessToken)
 {
     if ($this->resourceOwner === null) {
         $this->resourceOwner = $this->provider->getResourceOwner($accessToken);
     }
     return $this->resourceOwner;
 }
开发者ID:bolt,项目名称:Members,代码行数:16,代码来源:AbstractHandler.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: handle

 /**
  * @param Request $request
  * @return \Psr\Http\Message\ResponseInterface|RedirectResponse
  */
 public function handle(Request $request)
 {
     $redirectUri = (string) $request->getAttribute('originalUri', $request->getUri())->withQuery('');
     $this->provider = $this->getProvider($redirectUri);
     $session = $request->getAttribute('session');
     $queryParams = $request->getQueryParams();
     $code = array_get($queryParams, 'code');
     $state = array_get($queryParams, 'state');
     if (!$code) {
         $authUrl = $this->provider->getAuthorizationUrl($this->getAuthorizationUrlOptions());
         $session->set('oauth2state', $this->provider->getState());
         return new RedirectResponse($authUrl . '&display=popup');
     } elseif (!$state || $state !== $session->get('oauth2state')) {
         $session->forget('oauth2state');
         echo 'Invalid state. Please close the window and try again.';
         exit;
     }
     $this->token = $this->provider->getAccessToken('authorization_code', compact('code'));
     $owner = $this->provider->getResourceOwner($this->token);
     $identification = $this->getIdentification($owner);
     $suggestions = $this->getSuggestions($owner);
     return $this->authResponse->make($request, $identification, $suggestions);
 }
开发者ID:flarum,项目名称:core,代码行数:27,代码来源:AbstractOAuth2Controller.php

示例4: 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

示例5: fetchUserFromToken

 /**
  * Returns the "User" information (called a resource owner).
  *
  * @param AccessToken $accessToken
  * @return \League\OAuth2\Client\Provider\ResourceOwnerInterface
  */
 public function fetchUserFromToken(AccessToken $accessToken)
 {
     return $this->provider->getResourceOwner($accessToken);
 }
开发者ID:knpuniversity,项目名称:oauth2-client-bundle,代码行数:10,代码来源:OAuth2Client.php

示例6: getResourceOwner

 /**
  * Requests and returns the resource owner of given access token.
  *
  * @param  AccessToken $token
  * @return ResourceOwnerInterface
  */
 public function getResourceOwner(AccessToken $token)
 {
     $this->openId = $this->getOpenId($token);
     return parent::getResourceOwner($token);
 }
开发者ID:lazyboywu,项目名称:oauth2-qq,代码行数:11,代码来源:Qq.php


注:本文中的League\OAuth2\Client\Provider\AbstractProvider::getResourceOwner方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。