Skip to content
Permalink
Browse files

bug #32379 [SecurityBundle] conditionally register services (xabbuh)

This PR was merged into the 3.4 branch.

Discussion
----------

[SecurityBundle] conditionally register services

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #32342
| License       | MIT
| Doc PR        |

Commits
-------

8fbcdf2 conditionally register services
  • Loading branch information...
chalasr committed Jul 5, 2019
2 parents d9833ac + 8fbcdf2 commit 7f4368114c83f10abf5e3b1c506b2a23e1539324
Showing with 14 additions and 4 deletions.
  1. +14 −4 src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
@@ -28,6 +28,8 @@
use Symfony\Component\Security\Core\Authorization\ExpressionLanguage;
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
use Symfony\Component\Security\Core\Encoder\Argon2iPasswordEncoder;
use Symfony\Component\Templating\Helper\Helper;
use Twig\Extension\AbstractExtension;
/**
* SecurityExtension.
@@ -69,8 +71,18 @@ public function load(array $configs, ContainerBuilder $container)
$loader->load('security.xml');
$loader->load('security_listeners.xml');
$loader->load('security_rememberme.xml');
$loader->load('templating_php.xml');
$loader->load('templating_twig.xml');
if (class_exists(Helper::class)) {
$loader->load('templating_php.xml');
$container->getDefinition('templating.helper.logout_url')->setPrivate(true);
$container->getDefinition('templating.helper.security')->setPrivate(true);
}
if (class_exists(AbstractExtension::class)) {
$loader->load('templating_twig.xml');
}
$loader->load('collectors.xml');
$loader->load('guard.xml');
@@ -79,8 +91,6 @@ public function load(array $configs, ContainerBuilder $container)
$container->getDefinition('security.firewall.context')->setPrivate(true);
$container->getDefinition('security.validator.user_password')->setPrivate(true);
$container->getDefinition('security.rememberme.response_listener')->setPrivate(true);
$container->getDefinition('templating.helper.logout_url')->setPrivate(true);
$container->getDefinition('templating.helper.security')->setPrivate(true);
$container->getAlias('security.encoder_factory')->setPrivate(true);
if ($container->hasParameter('kernel.debug') && $container->getParameter('kernel.debug')) {

0 comments on commit 7f43681

Please sign in to comment.
You can’t perform that action at this time.