Remove deprecated code

This commit is contained in:
Diego Saint Esteben 2015-08-01 22:28:02 -03:00
parent 9fea451295
commit 7c4f921664
4 changed files with 6 additions and 126 deletions

View File

@ -286,20 +286,6 @@ class MainConfiguration implements ConfigurationInterface
->end() ->end()
->arrayNode('anonymous') ->arrayNode('anonymous')
->canBeUnset() ->canBeUnset()
->beforeNormalization()
->ifTrue(function ($v) { return isset($v['key']); })
->then(function ($v) {
if (isset($v['secret'])) {
throw new \LogicException('Cannot set both key and secret options for security.firewall.anonymous, use only secret instead.');
}
@trigger_error('security.firewall.anonymous.key is deprecated since version 2.8 and will be removed in 3.0. Use security.firewall.anonymous.secret instead.', E_USER_DEPRECATED);
$v['secret'] = $v['key'];
unset($v['key']);
})
->end()
->children() ->children()
->scalarNode('secret')->defaultValue(uniqid('', true))->end() ->scalarNode('secret')->defaultValue(uniqid('', true))->end()
->end() ->end()

View File

@ -119,23 +119,10 @@ class RememberMeFactory implements SecurityFactoryInterface
public function addConfiguration(NodeDefinition $node) public function addConfiguration(NodeDefinition $node)
{ {
$node->fixXmlConfig('user_provider');
$builder = $node $builder = $node
->beforeNormalization() ->fixXmlConfig('user_provider')
->ifTrue(function ($v) { return isset($v['key']); }) ->children()
->then(function ($v) { ;
if (isset($v['secret'])) {
throw new \LogicException('Cannot set both key and secret options for remember_me, use only secret instead.');
}
@trigger_error('remember_me.key is deprecated since version 2.8 and will be removed in 3.0. Use remember_me.secret instead.', E_USER_DEPRECATED);
$v['secret'] = $v['key'];
unset($v['key']);
})
->end()
->children();
$builder $builder
->scalarNode('secret')->isRequired()->cannotBeEmpty()->end() ->scalarNode('secret')->isRequired()->cannotBeEmpty()->end()

View File

@ -11,10 +11,8 @@
namespace Symfony\Bundle\SecurityBundle\Templating\Helper; namespace Symfony\Bundle\SecurityBundle\Templating\Helper;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Http\Logout\LogoutUrlGenerator; use Symfony\Component\Security\Http\Logout\LogoutUrlGenerator;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Templating\Helper\Helper; use Symfony\Component\Templating\Helper\Helper;
/** /**
@ -29,26 +27,11 @@ class LogoutUrlHelper extends Helper
/** /**
* Constructor. * Constructor.
* *
* @param ContainerInterface|LogoutUrlGenerator $generator A ContainerInterface or LogoutUrlGenerator instance * @param LogoutUrlGenerator $generator A LogoutUrlGenerator instance
* @param UrlGeneratorInterface|null $router The router service
* @param TokenStorageInterface|null $tokenStorage The token storage service
*
* @deprecated Passing a ContainerInterface as a first argument is deprecated since 2.7 and will be removed in 3.0.
* @deprecated Passing a second and third argument is deprecated since 2.7 and will be removed in 3.0.
*/ */
public function __construct($generator, UrlGeneratorInterface $router = null, TokenStorageInterface $tokenStorage = null) public function __construct(LogoutUrlGenerator $generator)
{ {
if ($generator instanceof ContainerInterface) { $this->generator = $generator;
@trigger_error('The '.__CLASS__.' constructor will require a LogoutUrlGenerator instead of a ContainerInterface instance in 3.0.', E_USER_DEPRECATED);
if ($generator->has('security.logout_url_generator')) {
$this->generator = $generator->get('security.logout_url_generator');
} else {
$this->generator = new LogoutUrlGenerator($generator->get('request_stack'), $router, $tokenStorage);
}
} else {
$this->generator = $generator;
}
} }
/** /**

View File

@ -1,76 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\SecurityBundle\Twig\Extension;
@trigger_error('The '.__NAMESPACE__.'\LogoutUrlExtension class is deprecated since version 2.7 and will be removed in 3.0. Use Symfony\Bridge\Twig\Extension\LogoutUrlExtension instead.', E_USER_DEPRECATED);
use Symfony\Bundle\SecurityBundle\Templating\Helper\LogoutUrlHelper;
/**
* LogoutUrlHelper provides generator functions for the logout URL to Twig.
*
* @author Jeremy Mikola <jmikola@gmail.com>
*
* @deprecated since version 2.7, to be removed in 3.0. Use Symfony\Bridge\Twig\Extension\LogoutUrlExtension instead.
*/
class LogoutUrlExtension extends \Twig_Extension
{
private $helper;
public function __construct(LogoutUrlHelper $helper)
{
$this->helper = $helper;
}
/**
* {@inheritdoc}
*/
public function getFunctions()
{
return array(
new \Twig_SimpleFunction('logout_url', array($this, 'getLogoutUrl')),
new \Twig_SimpleFunction('logout_path', array($this, 'getLogoutPath')),
);
}
/**
* Generates the relative logout URL for the firewall.
*
* @param string|null $key The firewall key or null to use the current firewall key
*
* @return string The relative logout URL
*/
public function getLogoutPath($key = null)
{
return $this->helper->getLogoutPath($key);
}
/**
* Generates the absolute logout URL for the firewall.
*
* @param string|null $key The firewall key or null to use the current firewall key
*
* @return string The absolute logout URL
*/
public function getLogoutUrl($key = null)
{
return $this->helper->getLogoutUrl($key);
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'logout_url';
}
}