Skip to content

Commit

Permalink
[SecurityBundle] Drop cache.security_expression_language definition i…
Browse files Browse the repository at this point in the history
…f invalid
  • Loading branch information
chalasr committed Jun 19, 2020
1 parent 6c1e30e commit aa17aeb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,9 @@ public function process(ContainerBuilder $container)
$definition->addMethodCall('registerProvider', [new Reference($id)]);
}
}

if (!$container->hasDefinition('cache.system')) {
$container->removeDefinition('cache.security_expression_language');
}
}
}
2 changes: 1 addition & 1 deletion Resources/config/security.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<service id="security.user_checker" class="Symfony\Component\Security\Core\User\UserChecker" />

<service id="security.expression_language" class="Symfony\Component\Security\Core\Authorization\ExpressionLanguage">
<argument type="service" id="cache.security_expression_language"></argument>
<argument type="service" id="cache.security_expression_language" on-invalid="null" />
</service>

<service id="security.authentication_utils" class="Symfony\Component\Security\Http\Authentication\AuthenticationUtils" public="true">
Expand Down
21 changes: 15 additions & 6 deletions Tests/DependencyInjection/CompleteConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function testUserProviders()

// chain provider
$this->assertEquals([new IteratorArgument([
new Reference('security.user.provider.concrete.service'),
new Reference('user.manager'),
new Reference('security.user.provider.concrete.basic'),
])], $container->getDefinition('security.user.provider.concrete.chain')->getArguments());
}
Expand All @@ -70,9 +70,9 @@ public function testFirewalls()
foreach (array_keys($arguments[1]->getValues()) as $contextId) {
$contextDef = $container->getDefinition($contextId);
$arguments = $contextDef->getArguments();
$listeners[] = array_map('strval', $arguments['index_0']->getValues());
$listeners[] = array_map('strval', $arguments[0]->getValues());

$configDef = $container->getDefinition((string) $arguments['index_3']);
$configDef = $container->getDefinition((string) $arguments[3]);
$configs[] = array_values($configDef->getArguments());
}

Expand All @@ -87,6 +87,14 @@ public function testFirewalls()
'security.user_checker',
'.security.request_matcher.xmi9dcw',
false,
false,
'',
'',
'',
'',
'',
[],
null,
],
[
'secure',
Expand Down Expand Up @@ -657,9 +665,9 @@ public function testSimpleAuth()
foreach (array_keys($arguments[1]->getValues()) as $contextId) {
$contextDef = $container->getDefinition($contextId);
$arguments = $contextDef->getArguments();
$listeners[] = array_map('strval', $arguments['index_0']->getValues());
$listeners[] = array_map('strval', $arguments[0]->getValues());

$configDef = $container->getDefinition((string) $arguments['index_3']);
$configDef = $container->getDefinition((string) $arguments[3]);
$configs[] = array_values($configDef->getArguments());
}

Expand Down Expand Up @@ -708,6 +716,8 @@ protected function getContainer($file)

$container = new ContainerBuilder();
$container->setParameter('kernel.debug', false);
$container->setParameter('request_listener.http_port', 80);
$container->setParameter('request_listener.https_port', 443);

$security = new SecurityExtension();
$container->registerExtension($security);
Expand All @@ -716,7 +726,6 @@ protected function getContainer($file)
$bundle->build($container); // Attach all default factories
$this->getLoader($container)->load($file);

$container->getCompilerPassConfig()->setOptimizationPasses([]);
$container->getCompilerPassConfig()->setRemovingPasses([]);
$container->getCompilerPassConfig()->setAfterRemovingPasses([]);
$container->compile();
Expand Down

0 comments on commit aa17aeb

Please sign in to comment.