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


PHP GenericOAuth2ResourceOwner::getUserInformation方法代码示例

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


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

示例1: testGetUserInformation

 public function testGetUserInformation()
 {
     $this->markTestSkipped('Test will work from PHPUnit 3.7 onwards. See: https://github.com/sebastianbergmann/phpunit-mock-objects/issues/47.');
     $this->mockBuzz($this->userResponse);
     $userResponse = $this->resourceOwner->getUserInformation('access_token');
     $this->assertEquals('bar', $userResponse->getUsername());
     $this->assertEquals('access_token', $userResponse->getAccessToken());
 }
开发者ID:rafalwrzeszcz,项目名称:HWIOAuthBundle,代码行数:8,代码来源:GenericOAuth2ResourceOwnerTest.php

示例2: testGetUserInformationFailure

 public function testGetUserInformationFailure()
 {
     $exception = new RequestException();
     $this->buzzClient->expects($this->once())->method('send')->will($this->throwException($exception));
     try {
         $this->resourceOwner->getUserInformation(array('access_token' => 'token'));
         $this->fail('An exception should have been raised');
     } catch (HttpTransportException $e) {
         $this->assertSame($exception, $e->getPrevious());
     }
 }
开发者ID:destillat,项目名称:HWIOAuthBundle,代码行数:11,代码来源:GenericOAuth2ResourceOwnerTest.php

示例3: testGetUserInformation

 public function testGetUserInformation()
 {
     $this->mockBuzz($this->userResponse, 'application/json; charset=utf-8');
     /**
      * @var $userResponse \HWI\Bundle\OAuthBundle\OAuth\Response\AbstractUserResponse
      */
     $userResponse = $this->resourceOwner->getUserInformation(array('access_token' => 'token'));
     $this->assertEquals('1', $userResponse->getUsername());
     $this->assertEquals('bar', $userResponse->getNickname());
     $this->assertEquals('token', $userResponse->getAccessToken());
     $this->assertNull($userResponse->getRefreshToken());
     $this->assertNull($userResponse->getExpiresIn());
 }
开发者ID:michaeljayt,项目名称:HWIOAuthBundle,代码行数:13,代码来源:GenericOAuth2ResourceOwnerTest.php

示例4: getUserInformation

 /**
  * {@inheritDoc}
  */
 public function getUserInformation(array $accessToken, array $extraParameters = array())
 {
     if ($this->options['appsecret_proof']) {
         $extraParameters['appsecret_proof'] = hash_hmac('sha256', $accessToken['access_token'], $this->options['client_secret']);
     }
     return parent::getUserInformation($accessToken, $extraParameters);
 }
开发者ID:jayesbe,项目名称:HWIOAuthBundle,代码行数:10,代码来源:FacebookResourceOwner.php

示例5: getUserInformation

 /**
  * Override for Orcid
  *
  * {@inheritDoc}
  */
 public function getUserInformation(array $accessToken, array $extraParameters = array())
 {
     if (!array_key_exists('orcid', $accessToken)) {
         return parent::getUserInformation($accessToken, $extraParameters);
     }
     $orcidService = new OrcidService();
     $bio = $orcidService->getBio($accessToken["orcid"]);
     $response = $this->getUserResponse();
     $response->setResponse($bio);
     $response->setResourceOwner($this);
     $response->setOAuthToken(new OAuthToken($accessToken));
     return $response;
 }
开发者ID:beyzakokcan,项目名称:ojs,代码行数:18,代码来源:GenericOAuth2ResourceOwner.php

示例6: getUserInformation

 /**
  * {@inheritDoc}
  */
 public function getUserInformation(array $accessToken, array $extraParameters = array())
 {
     $response = parent::getUserInformation($accessToken, $extraParameters);
     $responseData = $response->getResponse();
     // fetch the email addresses linked to the account
     if (empty($responseData['email'])) {
         $content = $this->httpRequest($this->normalizeUrl($this->options['emails_url']), null, array('Authorization: Bearer ' . $accessToken['access_token']));
         foreach ($this->getResponseContent($content)['values'] as $email) {
             // we only need the primary email address
             if (true === $email['is_primary']) {
                 $responseData['email'] = $email['email'];
             }
         }
         $response->setResponse($responseData);
     }
     return $response;
 }
开发者ID:ismailbaskin,项目名称:HWIOAuthBundle,代码行数:20,代码来源:Bitbucket2ResourceOwner.php

示例7: getUserInformation

 /**
  * {@inheritDoc}
  */
 public function getUserInformation(array $accessToken, array $extraParameters = array())
 {
     // SalesForce returns the infos_url in the OAuth Response Token
     $this->options['infos_url'] = $accessToken['id'];
     return parent::getUserInformation($accessToken, $extraParameters);
 }
开发者ID:raphydev,项目名称:onep,代码行数:9,代码来源:SalesforceResourceOwner.php


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