• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ResourceOwner\GenericOAuth2ResourceOwner类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createResourceOwner

 protected function createResourceOwner(array $options, $name, $paths = null)
 {
     $this->buzzClient = $this->getMockBuilder('\\Buzz\\Client\\ClientInterface')->disableOriginalConstructor()->getMock();
     $httpUtils = $this->getMockBuilder('\\Symfony\\Component\\Security\\Http\\HttpUtils')->disableOriginalConstructor()->getMock();
     $resourceOwner = new GenericOAuth2ResourceOwner($this->buzzClient, $httpUtils, $options, $name);
     $resourceOwner->addPaths($paths ?: $this->getDefaultPaths());
     return $resourceOwner;
 }
开发者ID:nickrouty,项目名称:HWIOAuthBundle,代码行数:8,代码来源:GenericOAuth2ResourceOwnerTest.php


示例2: testCsrfTokenIsValidWhenDisabled

 public function testCsrfTokenIsValidWhenDisabled()
 {
     if ($this->csrf) {
         $this->markTestSkipped('CSRF is enabled for this Resource Owner.');
     }
     $this->storage->expects($this->never())->method('fetch');
     $this->assertTrue($this->resourceOwner->isCsrfTokenValid('whatever you want'));
 }
开发者ID:michaeljayt,项目名称:HWIOAuthBundle,代码行数:8,代码来源:GenericOAuth2ResourceOwnerTest.php


示例3: configureOptions

 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolverInterface $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'https://accounts.google.com/o/oauth2/auth', 'access_token_url' => 'https://accounts.google.com/o/oauth2/token', 'revoke_token_url' => 'https://accounts.google.com/o/oauth2/revoke', 'infos_url' => 'https://www.googleapis.com/oauth2/v1/userinfo', 'scope' => 'https://www.googleapis.com/auth/userinfo.profile', 'access_type' => null, 'approval_prompt' => null, 'display' => null, 'hd' => null, 'login_hint' => null, 'prompt' => null, 'request_visible_actions' => null));
     if (method_exists($resolver, 'setDefined')) {
         $resolver->setAllowedValues('access_type', array('online', 'offline', null))->setAllowedValues('approval_prompt', array('force', 'auto', null))->setAllowedValues('display', array('page', 'popup', 'touch', 'wap', null))->setAllowedValues('login_hint', array('email address', 'sub', null))->setAllowedValues('prompt', array('consent', 'select_account', null));
     } else {
         $resolver->setAllowedValues(array('access_type' => array('online', 'offline', null), 'approval_prompt' => array('force', 'auto', null), 'display' => array('page', 'popup', 'touch', 'wap', null), 'login_hint' => array('email address', 'sub', null), 'prompt' => array('consent', 'select_account', null)));
     }
 }
开发者ID:destillat,项目名称:HWIOAuthBundle,代码行数:13,代码来源:GoogleResourceOwner.php


示例4: configureOptions

 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => '{base_url}/oauth2/authorize', 'access_token_url' => '{base_url}/oauth2/token', 'revoke_token_url' => '{base_url}/oauth2/revoke', 'infos_url' => '{base_url}/user'));
     $resolver->setRequired(array('base_url'));
     $normalizer = function (Options $options, $value) {
         return str_replace('{base_url}', $options['base_url'], $value);
     };
     $resolver->setNormalizers(array('authorization_url' => $normalizer, 'access_token_url' => $normalizer, 'revoke_token_url' => $normalizer, 'infos_url' => $normalizer));
 }
开发者ID:shurastik,项目名称:hwioauthbundle,代码行数:13,代码来源:FiwareResourceOwner.php


示例5: configureOptions

 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolverInterface $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setRequired('base_url');
     $resolver->setDefaults(array('authorization_url' => '{base_url}/admin/oauth/authorize', 'access_token_url' => '{base_url}/admin/oauth/access_token', 'infos_url' => '{base_url}/admin/shop.json', 'use_bearer_authorization' => false));
     $baseUrlNormalizer = function (Options $options, $value) {
         return strtr($value, ['{base_url}' => $options['base_url']]);
     };
     $resolver->setNormalizers(['authorization_url' => $baseUrlNormalizer, 'access_token_url' => $baseUrlNormalizer, 'infos_url' => $baseUrlNormalizer]);
 }
开发者ID:emarref,项目名称:ShopiyOAuthBundle,代码行数:13,代码来源:ShopifyResourceOwner.php


示例6: configureOptions

 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'https://accounts.google.com/o/oauth2/auth', 'access_token_url' => 'https://accounts.google.com/o/oauth2/token', 'revoke_token_url' => 'https://accounts.google.com/o/oauth2/revoke', 'infos_url' => 'https://www.googleapis.com/youtube/v3/channels?part=id,snippet&mine=true', 'scope' => 'https://www.googleapis.com/auth/youtube.readonly', 'access_type' => null, 'approval_prompt' => null, 'display' => null, 'hd' => null, 'login_hint' => null, 'prompt' => null, 'request_visible_actions' => null));
     // Symfony <2.6 BC
     if (method_exists($resolver, 'setDefined')) {
         $resolver->setAllowedValues('access_type', array('online', 'offline', null))->setAllowedValues('approval_prompt', array('force', 'auto', null))->setAllowedValues('display', array('page', 'popup', 'touch', 'wap', null))->setAllowedValues('login_hint', array('email address', 'sub', null))->setAllowedValues('prompt', array(null, 'consent', 'select_account', null));
     } else {
         $resolver->setAllowedValues(array('access_type' => array('online', 'offline', null), 'approval_prompt' => array('force', 'auto', null), 'display' => array('page', 'popup', 'touch', 'wap', null), 'login_hint' => array('email address', 'sub', null), 'prompt' => array(null, 'consent', 'select_account', null)));
     }
 }
开发者ID:ismailbaskin,项目名称:HWIOAuthBundle,代码行数:14,代码来源:YoutubeResourceOwner.php


示例7: configureOptions

 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolverInterface $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'https://oauth.vk.com/authorize', 'access_token_url' => 'https://oauth.vk.com/access_token', 'infos_url' => 'https://api.vk.com/method/users.get', 'use_commas_in_scope' => true, 'fields' => 'nickname,photo_50', 'name_case' => null));
     $resolver->setNormalizers(array('fields' => function (Options $options, $value) {
         if (!$value) {
             return null;
         }
         return is_array($value) ? implode(',', $value) : $value;
     }));
 }
开发者ID:redkeet,项目名称:oauth-bundle,代码行数:14,代码来源:VkontakteResourceOwner.php


示例8: configureOptions

 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolverInterface $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'https://api.dailymotion.com/oauth/authorize', 'access_token_url' => 'https://api.dailymotion.com/oauth/token', 'infos_url' => 'https://api.dailymotion.com/me', 'display' => null));
     if (method_exists($resolver, 'setDefined')) {
         // @link http://www.dailymotion.com/doc/api/authentication.html#dialog-form-factors
         $resolver->setAllowedValues('display', array('page', 'popup', 'mobile', null));
     } else {
         $resolver->setAllowedValues(array('display' => array('page', 'popup', 'mobile', null)));
     }
 }
开发者ID:destillat,项目名称:HWIOAuthBundle,代码行数:14,代码来源:DailymotionResourceOwner.php


示例9: configureOptions

 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolverInterface $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'https://www.facebook.com/v2.0/dialog/oauth', 'access_token_url' => 'https://graph.facebook.com/v2.0/oauth/access_token', 'revoke_token_url' => 'https://graph.facebook.com/v2.0/me/permissions', 'infos_url' => 'https://graph.facebook.com/v2.0/me', 'use_commas_in_scope' => true, 'display' => null, 'auth_type' => null, 'appsecret_proof' => false));
     // Symfony <2.6 BC
     if (method_exists($resolver, 'setDefined')) {
         $resolver->setAllowedValues('display', array('page', 'popup', 'touch', null))->setAllowedValues('auth_type', array('rerequest', null))->setAllowedTypes('appsecret_proof', 'bool');
     } else {
         $resolver->setAllowedValues(array('display' => array('page', 'popup', 'touch', null), 'auth_type' => array('rerequest', null), 'appsecret_proof' => array(true, false)));
     }
 }
开发者ID:jayesbe,项目名称:HWIOAuthBundle,代码行数:14,代码来源:FacebookResourceOwner.php


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


示例11: configureOptions

 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolverInterface $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('sandbox' => false, 'scope' => 'openid email', 'authorization_url' => 'https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize', 'access_token_url' => 'https://api.paypal.com/v1/identity/openidconnect/tokenservice', 'infos_url' => 'https://api.paypal.com/v1/identity/openidconnect/userinfo/?schema=openid'));
     $resolver->addAllowedTypes(array('sandbox' => 'bool'));
     $sandboxTransformation = function (Options $options, $value) {
         if (!$options['sandbox']) {
             return $value;
         }
         return preg_replace('~\\.paypal\\.~', '.sandbox.paypal.', $value, 1);
     };
     $resolver->setNormalizers(array('authorization_url' => $sandboxTransformation, 'access_token_url' => $sandboxTransformation, 'infos_url' => $sandboxTransformation));
 }
开发者ID:senthilkumar3282,项目名称:HWIOAuthBundle,代码行数:16,代码来源:PaypalResourceOwner.php


示例12: configureOptions

 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => '{base_url}/authorize', 'access_token_url' => '{base_url}/oauth/token', 'infos_url' => '{base_url}/userinfo'));
     $resolver->setRequired(array('base_url'));
     $normalizer = function (Options $options, $value) {
         return str_replace('{base_url}', $options['base_url'], $value);
     };
     // Symfony <2.6 BC
     if (method_exists($resolver, 'setNormalizer')) {
         $resolver->setNormalizer('authorization_url', $normalizer)->setNormalizer('access_token_url', $normalizer)->setNormalizer('infos_url', $normalizer);
     } else {
         $resolver->setNormalizers(array('authorization_url' => $normalizer, 'access_token_url' => $normalizer, 'infos_url' => $normalizer));
     }
 }
开发者ID:shurastik,项目名称:hwioauthbundle,代码行数:18,代码来源:Auth0ResourceOwner.php


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


示例14: configureOptions

 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'https://oauth.vk.com/authorize', 'access_token_url' => 'https://oauth.vk.com/access_token', 'infos_url' => 'https://api.vk.com/method/users.get', 'scope' => 'email', 'use_commas_in_scope' => true, 'fields' => 'nickname,photo_medium,screen_name,email', 'name_case' => null));
     $fieldsNormalizer = function (Options $options, $value) {
         if (!$value) {
             return null;
         }
         return is_array($value) ? implode(',', $value) : $value;
     };
     // Symfony <2.6 BC
     if (method_exists($resolver, 'setNormalizer')) {
         $resolver->setNormalizer('fields', $fieldsNormalizer);
     } else {
         $resolver->setNormalizers(array('fields' => $fieldsNormalizer));
     }
 }
开发者ID:ismailbaskin,项目名称:HWIOAuthBundle,代码行数:20,代码来源:VkontakteResourceOwner.php


示例15: getResponseContent

 /**
  * {@inheritDoc}
  */
 protected function getResponseContent(HttpMessageInterface $rawResponse)
 {
     $response = parent::getResponseContent($rawResponse);
     // Foursquare use quite custom response structure in case of error
     if (isset($response['meta']['errorType'])) {
         // Prevent to mark deprecated calls as errors
         if (200 == $response['meta']['code']) {
             $response['error'] = $response['meta']['errorType'];
             // Try to add some details of error if available
             if (isset($response['meta']['errorMessage'])) {
                 $response['error'] .= ' ' . $response['meta']['errorMessage'];
             } elseif (isset($response['meta']['errorDetail'])) {
                 $response['error'] .= ' ' . $response['meta']['errorDetail'];
             }
         }
         unset($response['meta']);
     }
     return $response;
 }
开发者ID:rafalwrzeszcz,项目名称:HWIOAuthBundle,代码行数:22,代码来源:FoursquareResourceOwner.php


示例16: configureOptions

 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolverInterface $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('sandbox' => false, 'authorization_url' => 'https://login.salesforce.com/services/oauth2/authorize', 'access_token_url' => 'https://login.salesforce.com/services/oauth2/token', 'infos_url' => null, 'format' => 'json'));
     $sandboxTransformation = function (Options $options, $value) {
         if (!$options['sandbox']) {
             return $value;
         }
         return preg_replace('~login\\.~', 'test.', $value, 1);
     };
     // Symfony <2.6 BC
     if (method_exists($resolver, 'setNormalizer')) {
         $resolver->setNormalizer('authorization_url', $sandboxTransformation)->setNormalizer('access_token_url', $sandboxTransformation);
         $resolver->addAllowedTypes('sandbox', 'bool');
     } else {
         $resolver->setNormalizers(array('authorization_url' => $sandboxTransformation, 'access_token_url' => $sandboxTransformation));
         $resolver->addAllowedTypes(array('sandbox' => 'bool'));
     }
 }
开发者ID:raphydev,项目名称:onep,代码行数:22,代码来源:SalesforceResourceOwner.php


示例17: configureOptions

    /**
     * {@inheritDoc}
     */
    protected function configureOptions(OptionsResolverInterface $resolver)
    {
        parent::configureOptions($resolver);

        $resolver->setDefaults(array(
            'authorization_url'   => 'https://www.facebook.com/dialog/oauth',
            'access_token_url'    => 'https://graph.facebook.com/oauth/access_token',
            'revoke_token_url'    => 'https://graph.facebook.com/me/permissions',
            'infos_url'           => 'https://graph.facebook.com/me',

            'use_commas_in_scope' => true,

            'display'             => null,
        ));

        $resolver->setAllowedValues(array(
            // @link https://developers.facebook.com/docs/reference/dialogs/#display
            'display' => array('page', 'popup', 'touch'),
        ));
    }
开发者ID:xxspartan16,项目名称:BMS-Market,代码行数:23,代码来源:FacebookResourceOwner.php


示例18: configureOptions

 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'https://api.weibo.com/oauth2/authorize', 'access_token_url' => 'https://api.weibo.com/oauth2/access_token', 'infos_url' => 'https://api.weibo.com/2/users/show.json'));
 }
开发者ID:ismailbaskin,项目名称:HWIOAuthBundle,代码行数:8,代码来源:SinaWeiboResourceOwner.php


示例19: configureOptions

 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolverInterface $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'https://api.hubic.com/oauth/auth/', 'access_token_url' => 'https://api.hubic.com/oauth/token/', 'infos_url' => 'https://api.hubic.com/1.0/account'));
 }
开发者ID:redkeet,项目名称:oauth-bundle,代码行数:8,代码来源:HubicResourceOwner.php


示例20: configureOptions

 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolverInterface $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'https://www.box.com/api/oauth2/authorize', 'access_token_url' => 'https://www.box.com/api/oauth2/token', 'revoke_token_url' => 'https://www.box.com/api/oauth2/revoke', 'infos_url' => 'https://api.box.com/2.0/users/me'));
 }
开发者ID:michaeljayt,项目名称:HWIOAuthBundle,代码行数:8,代码来源:BoxResourceOwner.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Response\UserResponseInterface类代码示例发布时间:2022-05-23
下一篇:
PHP widgets\AjaxButton类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap