Remove deprecated code
This commit is contained in:
parent
9fea451295
commit
7c4f921664
@ -286,20 +286,6 @@ class MainConfiguration implements ConfigurationInterface
|
||||
->end()
|
||||
->arrayNode('anonymous')
|
||||
->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()
|
||||
->scalarNode('secret')->defaultValue(uniqid('', true))->end()
|
||||
->end()
|
||||
|
@ -119,23 +119,10 @@ class RememberMeFactory implements SecurityFactoryInterface
|
||||
|
||||
public function addConfiguration(NodeDefinition $node)
|
||||
{
|
||||
$node->fixXmlConfig('user_provider');
|
||||
$builder = $node
|
||||
->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 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();
|
||||
->fixXmlConfig('user_provider')
|
||||
->children()
|
||||
;
|
||||
|
||||
$builder
|
||||
->scalarNode('secret')->isRequired()->cannotBeEmpty()->end()
|
||||
|
@ -11,10 +11,8 @@
|
||||
|
||||
namespace Symfony\Bundle\SecurityBundle\Templating\Helper;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Security\Http\Logout\LogoutUrlGenerator;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Component\Templating\Helper\Helper;
|
||||
|
||||
/**
|
||||
@ -29,26 +27,11 @@ class LogoutUrlHelper extends Helper
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param ContainerInterface|LogoutUrlGenerator $generator A ContainerInterface or 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.
|
||||
* @param LogoutUrlGenerator $generator A LogoutUrlGenerator instance
|
||||
*/
|
||||
public function __construct($generator, UrlGeneratorInterface $router = null, TokenStorageInterface $tokenStorage = null)
|
||||
public function __construct(LogoutUrlGenerator $generator)
|
||||
{
|
||||
if ($generator instanceof ContainerInterface) {
|
||||
@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;
|
||||
}
|
||||
$this->generator = $generator;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user