Skip to content

Commit

Permalink
Remove usage of OptionsResolverInterface to fix compatibility with Sy…
Browse files Browse the repository at this point in the history
…mfony 3

Remove `setScope()` call
Remove `firewall_name` configuration in favor of `firewall_names`
  • Loading branch information
Joseph Bielawski authored and stloyd committed Mar 8, 2016
1 parent 484fb50 commit 8d6785c
Show file tree
Hide file tree
Showing 74 changed files with 240 additions and 247 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ matrix:
env: SYMFONY_VERSION=2.7.*
- php: 5.6
env: SYMFONY_VERSION=2.8.*
- php: 5.6
env: SYMFONY_VERSION=3.0.*
- php: 5.6
env: FOSUSERBUNDLE_VERSION=1.3.*
- php: 5.6
env: FOSUSERBUNDLE_VERSION=2.0.*@dev
- php: hhvm

cache:
directories:
Expand Down
4 changes: 2 additions & 2 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ public function getConfigTreeBuilder()
$rootNode = $builder->root('hwi_oauth');
$rootNode
->children()
// TODO: firewall_names should replace firewall_name in next major version, and should be ->isRequired()->cannotBeEmpty()
->scalarNode('firewall_name')->end()
->arrayNode('firewall_names')
->isRequired()
->cannotBeEmpty()
->prototype('scalar')->end()
->end()
->scalarNode('target_path_parameter')->defaultNull()->end()
Expand Down
12 changes: 2 additions & 10 deletions DependencyInjection/HWIOAuthExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
* HWIOAuthExtension
*
* @author Geoffrey Bachelet <[email protected]>
* @author Alexander <[email protected]>
*/
Expand Down Expand Up @@ -53,13 +51,8 @@ public function load(array $configs, ContainerBuilder $container)
}

// set current firewall
if (empty($config['firewall_names']) && !isset($config['firewall_name'])) {
throw new InvalidConfigurationException('The child node "firewall_name" or "firewall_names" at path "hwi_oauth" must be configured.');
} elseif (!empty($config['firewall_names']) && isset($config['firewall_name'])) {
$config['firewall_names'] = array_merge(array($config['firewall_name']), $config['firewall_names']);
} elseif (empty($config['firewall_names']) && isset($config['firewall_name'])) {
@trigger_error('The child node "firewall_name" at path "hwi_oauth" is deprecated since version 0.4.0 and will be removed in version 0.5.0. Use "firewall_names" instead.', E_USER_DEPRECATED);
$config['firewall_names'] = array($config['firewall_name']);
if (empty($config['firewall_names'])) {
throw new InvalidConfigurationException('The child node "firewall_names" at path "hwi_oauth" must be configured.');
}
$container->setParameter('hwi_oauth.firewall_names', $config['firewall_names']);

Expand Down Expand Up @@ -111,7 +104,6 @@ public function load(array $configs, ContainerBuilder $container)
$container
->setDefinition('hwi_oauth.registration.form.handler.fosub_bridge', new DefinitionDecorator('hwi_oauth.registration.form.handler.fosub_bridge.def'))
->addArgument($config['fosub']['username_iterations'])
->setScope('request')
;

$container->setAlias('hwi_oauth.registration.form.handler', 'hwi_oauth.registration.form.handler.fosub_bridge');
Expand Down
5 changes: 2 additions & 3 deletions OAuth/ResourceOwner/AbstractResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use HWI\Bundle\OAuthBundle\OAuth\Response\PathUserResponse;
use HWI\Bundle\OAuthBundle\OAuth\Response\UserResponseInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\HttpUtils;

Expand Down Expand Up @@ -312,9 +311,9 @@ abstract protected function doGetUserInformationRequest($url, array $parameters
/**
* Configure the option resolver
*
* @param OptionsResolverInterface $resolver
* @param OptionsResolver $resolver
*/
protected function configureOptions(OptionsResolverInterface $resolver)
protected function configureOptions(OptionsResolver $resolver)
{
$resolver->setRequired(array(
'client_id',
Expand Down
4 changes: 2 additions & 2 deletions OAuth/ResourceOwner/AmazonResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace HWI\Bundle\OAuthBundle\OAuth\ResourceOwner;

use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* AmazonResourceOwner
Expand All @@ -33,7 +33,7 @@ class AmazonResourceOwner extends GenericOAuth2ResourceOwner
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);

Expand Down
7 changes: 3 additions & 4 deletions OAuth/ResourceOwner/Auth0ResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use Buzz\Message\RequestInterface as HttpRequestInterface;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* Auth0ResourceOwner
Expand All @@ -38,21 +38,20 @@ class Auth0ResourceOwner extends GenericOAuth2ResourceOwner
*/
protected function doGetTokenRequest($url, array $parameters = array())
{

$headers = array(
'Content-Type' => 'application/x-www-form-urlencoded'
);

return $this->httpRequest($url, http_build_query($parameters, '', '&'), $headers, HttpRequestInterface::METHOD_POST);
}


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

$resolver->setDefaults(array(
'authorization_url' => '{base_url}/authorize',
'access_token_url' => '{base_url}/oauth/token',
Expand Down
4 changes: 2 additions & 2 deletions OAuth/ResourceOwner/AzureResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace HWI\Bundle\OAuthBundle\OAuth\ResourceOwner;

use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

use HWI\Bundle\OAuthBundle\Security\Core\Authentication\Token\OAuthToken;

Expand Down Expand Up @@ -98,7 +98,7 @@ public function getUserInformation(array $accessToken, array $extraParameters =
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);

Expand Down
4 changes: 2 additions & 2 deletions OAuth/ResourceOwner/BitbucketResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace HWI\Bundle\OAuthBundle\OAuth\ResourceOwner;

use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* BitbucketResourceOwner
Expand All @@ -33,7 +33,7 @@ class BitbucketResourceOwner extends GenericOAuth1ResourceOwner
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);

Expand Down
4 changes: 2 additions & 2 deletions OAuth/ResourceOwner/BitlyResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace HWI\Bundle\OAuthBundle\OAuth\ResourceOwner;

use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* BitlyResourceOwner
Expand All @@ -33,7 +33,7 @@ class BitlyResourceOwner extends GenericOAuth2ResourceOwner
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);

Expand Down
4 changes: 2 additions & 2 deletions OAuth/ResourceOwner/BoxResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace HWI\Bundle\OAuthBundle\OAuth\ResourceOwner;

use Buzz\Message\RequestInterface as HttpRequestInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* BoxResourceOwner
Expand Down Expand Up @@ -51,7 +51,7 @@ public function revokeToken($token)
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);

Expand Down
4 changes: 2 additions & 2 deletions OAuth/ResourceOwner/BufferAppResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace HWI\Bundle\OAuthBundle\OAuth\ResourceOwner;

use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* BufferAppResourceOwner
Expand All @@ -32,7 +32,7 @@ class BufferAppResourceOwner extends GenericOAuth2ResourceOwner
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);

Expand Down
4 changes: 2 additions & 2 deletions OAuth/ResourceOwner/DailymotionResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace HWI\Bundle\OAuthBundle\OAuth\ResourceOwner;

use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* DailymotionResourceOwner
Expand Down Expand Up @@ -42,7 +42,7 @@ public function getAuthorizationUrl($redirectUri, array $extraParameters = array
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);

Expand Down
4 changes: 2 additions & 2 deletions OAuth/ResourceOwner/DeezerResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace HWI\Bundle\OAuthBundle\OAuth\ResourceOwner;

use HWI\Bundle\OAuthBundle\Security\Core\Authentication\Token\OAuthToken;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* @author Kieu Anh Tuan <[email protected]>
Expand All @@ -36,7 +36,7 @@ class DeezerResourceOwner extends GenericOAuth2ResourceOwner
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);

Expand Down
4 changes: 2 additions & 2 deletions OAuth/ResourceOwner/DeviantartResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace HWI\Bundle\OAuthBundle\OAuth\ResourceOwner;

use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* DeviantartResourceOwner
Expand All @@ -32,7 +32,7 @@ class DeviantartResourceOwner extends GenericOAuth2ResourceOwner
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);

Expand Down
4 changes: 2 additions & 2 deletions OAuth/ResourceOwner/DiscogsResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace HWI\Bundle\OAuthBundle\OAuth\ResourceOwner;

use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class DiscogsResourceOwner extends GenericOAuth1ResourceOwner
{
Expand All @@ -17,7 +17,7 @@ class DiscogsResourceOwner extends GenericOAuth1ResourceOwner
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);

Expand Down
4 changes: 2 additions & 2 deletions OAuth/ResourceOwner/DisqusResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace HWI\Bundle\OAuthBundle\OAuth\ResourceOwner;

use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* DisqusResourceOwner
Expand Down Expand Up @@ -46,7 +46,7 @@ protected function doGetUserInformationRequest($url, array $parameters = array()
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);

Expand Down
4 changes: 2 additions & 2 deletions OAuth/ResourceOwner/DropboxResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace HWI\Bundle\OAuthBundle\OAuth\ResourceOwner;

use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* DropboxResourceOwner
Expand All @@ -33,7 +33,7 @@ class DropboxResourceOwner extends GenericOAuth2ResourceOwner
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);

Expand Down
4 changes: 2 additions & 2 deletions OAuth/ResourceOwner/EveOnlineResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace HWI\Bundle\OAuthBundle\OAuth\ResourceOwner;

use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* EveOnlineResourceOwner
Expand All @@ -32,7 +32,7 @@ class EveOnlineResourceOwner extends GenericOAuth2ResourceOwner
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);

Expand Down
4 changes: 2 additions & 2 deletions OAuth/ResourceOwner/EventbriteResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace HWI\Bundle\OAuthBundle\OAuth\ResourceOwner;

use Buzz\Message\RequestInterface as HttpRequestInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* EventbriteResourceOwner
Expand Down Expand Up @@ -44,7 +44,7 @@ protected function doGetTokenRequest($url, array $parameters = array())
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);

Expand Down
4 changes: 2 additions & 2 deletions OAuth/ResourceOwner/FacebookResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use Buzz\Message\RequestInterface as HttpRequestInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* FacebookResourceOwner
Expand Down Expand Up @@ -98,7 +98,7 @@ public function revokeToken($token)
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);

Expand Down
4 changes: 2 additions & 2 deletions OAuth/ResourceOwner/FiwareResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use HWI\Bundle\OAuthBundle\Security\Core\Authentication\Token\OAuthToken;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Buzz\Message\RequestInterface as HttpRequestInterface;

/**
Expand Down Expand Up @@ -85,7 +85,7 @@ public function getUserInformation(array $accessToken, array $extraParameters =
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);

Expand Down
Loading

0 comments on commit 8d6785c

Please sign in to comment.