/**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolverInterface $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setRequired(array('request_token_url'));
     $resolver->setDefaults(array('realm' => null, 'signature_method' => 'HMAC-SHA1'));
     if (method_exists($resolver, 'setDefined')) {
         $resolver->setAllowedValues('signature_method', array('HMAC-SHA1', 'RSA-SHA1', 'PLAINTEXT'));
     } else {
         $resolver->setAllowedValues(array('signature_method' => array('HMAC-SHA1', 'RSA-SHA1', 'PLAINTEXT')));
     }
 }
 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolverInterface $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('attr_name' => 'access_token', 'use_commas_in_scope' => false, 'use_bearer_authorization' => true));
     $resolver->setOptional(array('revoke_token_url'));
     $resolver->setNormalizers(array('scope' => function (Options $options, $value) {
         if (!$value) {
             return null;
         }
         if (!$options['use_commas_in_scope']) {
             return $value;
         }
         return str_replace(',', ' ', $value);
     }));
 }
 /**
  * {@inheritDoc}
  */
 protected function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('attr_name' => 'access_token', 'use_commas_in_scope' => false, 'use_bearer_authorization' => true));
     // Symfony <2.6 BC
     if (method_exists($resolver, 'setDefined')) {
         $resolver->setDefined('revoke_token_url');
     } else {
         $resolver->setOptional(array('revoke_token_url'));
     }
     // Unfortunately some resource owners break the spec by using commas instead
     // of spaces to separate scopes (Disqus, Facebook, Github, Vkontante)
     $scopeNormalizer = function (Options $options, $value) {
         if (!$value) {
             return null;
         }
         if (!$options['use_commas_in_scope']) {
             return $value;
         }
         return str_replace(',', ' ', $value);
     };
     // Symfony <2.6 BC
     if (method_exists($resolver, 'setNormalizer')) {
         $resolver->setNormalizer('scope', $scopeNormalizer);
     } else {
         $resolver->setNormalizers(array('scope' => $scopeNormalizer));
     }
 }
 /**
  * {@inheritDoc}
  */
 protected function httpRequest($url, $content = null, $parameters = array(), $headers = array(), $method = null)
 {
     $authorization = 'Authorization: OAuth';
     if (null !== $this->getOption('realm')) {
         $authorization = 'Authorization: OAuth realm="' . rawurlencode($this->getOption('realm')) . '"';
     }
     foreach ($parameters as $key => $value) {
         $value = rawurlencode($value);
         $authorization .= ", {$key}=\"{$value}\"";
     }
     $headers[] = $authorization;
     return parent::httpRequest($url, $content, $headers, $method);
 }