コード例 #1
0
 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();
     $this->storage = $this->getMock('\\HWI\\Bundle\\OAuthBundle\\OAuth\\OAuth1RequestTokenStorageInterface');
     $resourceOwner = new GenericOAuth1ResourceOwner($this->buzzClient, $httpUtils, $options, $name, $this->storage);
     $resourceOwner->addPaths($paths ?: $this->getDefaultPaths());
     return $resourceOwner;
 }
コード例 #2
0
 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolverInterface $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'https://api.twitter.com/oauth/authenticate', 'request_token_url' => 'https://api.twitter.com/oauth/request_token', 'access_token_url' => 'https://api.twitter.com/oauth/access_token', 'infos_url' => 'https://api.twitter.com/1.1/account/verify_credentials.json'));
     $resolver->setOptional(array('x_auth_access_type'));
     $resolver->setAllowedValues(array('x_auth_access_type' => array('read', 'write')));
 }
コード例 #3
0
 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolverInterface $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('base_url' => '', 'authorization_url' => '{base_url}/plugins/servlet/oauth/authorize', 'request_token_url' => '{base_url}/plugins/servlet/oauth/request-token', 'access_token_url' => '{base_url}/plugins/servlet/oauth/access-token', 'infos_url' => '{base_url}/rest/api/2/user', 'signature_method' => 'RSA-SHA1'));
     $normalizer = function (Options $options, $value) {
         return str_replace('{base_url}', $options['base_url'], $value);
     };
     $resolver->setNormalizers(array('authorization_url' => $normalizer, 'request_token_url' => $normalizer, 'access_token_url' => $normalizer, 'infos_url' => $normalizer));
 }
コード例 #4
0
 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'https://api.twitter.com/oauth/authenticate', 'request_token_url' => 'https://api.twitter.com/oauth/request_token', 'access_token_url' => 'https://api.twitter.com/oauth/access_token', 'infos_url' => 'https://api.twitter.com/1.1/account/verify_credentials.json?include_email=true', 'x_auth_access_type' => 'write', 'include_entities' => null, 'skip_status' => null, 'include_email' => true));
     // Symfony <2.6 BC
     if (method_exists($resolver, 'setDefined')) {
         $resolver->setAllowedValues('x_auth_access_type', array('read', 'write'))->setAllowedValues('include_entities', array(true, false, null))->setAllowedValues('skip_status', array(true, false, null))->setAllowedValues('include_email', array(true, false, null));
     } else {
         $resolver->setAllowedValues(array('x_auth_access_type' => array('read', 'write'), 'include_entities' => array(true, false, null), 'skip_status' => array(true, false, null), 'include_email' => array(true, false, null)));
     }
 }
コード例 #5
0
 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'https://www.tumblr.com/oauth/authorize', 'request_token_url' => 'https://www.tumblr.com/oauth/request_token', 'access_token_url' => 'https://www.tumblr.com/oauth/access_token', 'infos_url' => 'https://api.tumblr.com/v2/user/info'));
     // Symfony <2.6 BC
     if (method_exists($resolver, 'setDefined')) {
         $resolver->setDefined('x_auth_access_type');
         // @link https://dev.twitter.com/oauth/reference/post/oauth/request_token
         $resolver->setAllowedValues('x_auth_access_type', array('read', 'write'));
     } else {
         $resolver->setOptional(array('x_auth_access_type'));
         $resolver->setAllowedValues(array('x_auth_access_type' => array('read', 'write')));
     }
 }
コード例 #6
0
 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolverInterface $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'https://api.twitter.com/oauth/authenticate', 'request_token_url' => 'https://api.twitter.com/oauth/request_token', 'access_token_url' => 'https://api.twitter.com/oauth/access_token', 'infos_url' => 'https://api.twitter.com/1.1/account/verify_credentials.json'));
     // Symfony <2.6 BC
     if (method_exists($resolver, 'setDefined')) {
         $resolver->setDefined('x_auth_access_type');
         // @link https://dev.twitter.com/oauth/reference/post/oauth/request_token
         $resolver->setAllowedValues('x_auth_access_type', array('read', 'write'));
     } else {
         $resolver->setOptional(array('x_auth_access_type'));
         $resolver->setAllowedValues(array('x_auth_access_type' => array('read', 'write')));
     }
 }
コード例 #7
0
 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => '{base_url}/plugins/servlet/oauth/authorize', 'request_token_url' => '{base_url}/plugins/servlet/oauth/request-token', 'access_token_url' => '{base_url}/plugins/servlet/oauth/access-token', 'infos_session_url' => '{base_url}/rest/auth/1/session', 'infos_url' => '{base_url}/rest/api/2/user', 'signature_method' => 'RSA-SHA1'));
     $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('request_token_url', $normalizer)->setNormalizer('access_token_url', $normalizer)->setNormalizer('infos_session_url', $normalizer)->setNormalizer('infos_url', $normalizer);
     } else {
         $resolver->setNormalizers(array('authorization_url' => $normalizer, 'request_token_url' => $normalizer, 'access_token_url' => $normalizer, 'infos_session_url' => $normalizer, 'infos_url' => $normalizer));
     }
 }
コード例 #8
0
 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolverInterface $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'https://bitbucket.org/api/1.0/oauth/authenticate', 'request_token_url' => 'https://bitbucket.org/api/1.0/oauth/request_token', 'access_token_url' => 'https://bitbucket.org/api/1.0/oauth/access_token', 'infos_url' => 'https://bitbucket.org/api/1.0/user'));
 }
 public function testGetSetName()
 {
     $this->assertEquals($this->resourceOwnerName, $this->resourceOwner->getName());
     $this->resourceOwner->setName('foo');
     $this->assertEquals('foo', $this->resourceOwner->getName());
 }
コード例 #10
0
 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'https://api.xing.com/v1/authorize', 'request_token_url' => 'https://api.xing.com/v1/request_token', 'access_token_url' => 'https://api.xing.com/v1/access_token', 'infos_url' => 'https://api.xing.com/v1/users/me'));
 }
コード例 #11
0
 /**
  * Add scope (Required by linkedin API if email address is needed)
  *
  * {@inheritDoc}
  */
 protected function getRequestToken($redirectUri, array $extraParameters = array())
 {
     return parent::getRequestToken($redirectUri, array_merge(array('scope' => $this->getOption('scope')), $extraParameters));
 }
コード例 #12
0
 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'https://www.discogs.com/oauth/authorize', 'request_token_url' => 'https://api.discogs.com/oauth/request_token', 'access_token_url' => 'https://api.discogs.com/oauth/access_token', 'infos_url' => 'https://api.discogs.com/oauth/identity'));
 }
コード例 #13
0
 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'https://api.login.yahoo.com/oauth/v2/request_auth', 'request_token_url' => 'https://api.login.yahoo.com/oauth/v2/get_request_token', 'access_token_url' => 'https://api.login.yahoo.com/oauth/v2/get_token', 'infos_url' => 'https://social.yahooapis.com/v1/user/{guid}/profile', 'realm' => 'yahooapis.com'));
 }
コード例 #14
0
 /**
  * @param OptionsResolverInterface $resolver
  */
 protected function configureOptions(OptionsResolverInterface $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(['authorization_url' => self::OAUTH_AUTHORISE_URL, 'request_token_url' => self::OAUTH_REQUEST_URL, 'access_token_url' => self::OAUTH_ACCESS_URL, 'infos_url' => self::OAUTH_INFOS_URL, 'user_response_class' => IntuitUserResponse::class]);
 }
コード例 #15
0
 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'https://trello.com/1/OAuthAuthorizeToken', 'request_token_url' => 'https://trello.com/1/OAuthGetRequestToken', 'access_token_url' => 'https://trello.com/1/OAuthGetAccessToken', 'infos_url' => 'https://api.trello.com/1/members/me?fields=username,fullName,avatarSource,email'));
 }
コード例 #16
0
 /** {@inheritDoc} */
 protected function configureOptions(OptionsResolverInterface $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('sandbox' => true, 'infos_url' => null, 'request_token_url' => 'https://%s.evernote.com/oauth', 'authorization_url' => 'https://%s.evernote.com/OAuth.action', 'access_token_url' => 'https://%s.evernote.com/oauth'));
 }
コード例 #17
0
 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'http://www.flickr.com/services/oauth/authorize', 'request_token_url' => 'http://www.flickr.com/services/oauth/request_token', 'access_token_url' => 'http://www.flickr.com/services/oauth/access_token', 'infos_url' => null, 'perms' => 'read'));
 }
コード例 #18
0
 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolverInterface $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'http://www.stereomood.com/api/oauth/authenticate', 'request_token_url' => 'http://www.stereomood.com/api/oauth/request_token', 'access_token_url' => 'http://www.stereomood.com/api/oauth/access_token', 'infos_url' => null));
 }