Skip to content

Commit d645e21

Browse files
committed
Add a ChainUserChecker to allow calling multiple user checkers for a firewall
1 parent 1a08823 commit d645e21

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

DependencyInjection/SecurityExtension.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Symfony\Component\DependencyInjection\Alias;
2323
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
2424
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
25+
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
2526
use Symfony\Component\DependencyInjection\ChildDefinition;
2627
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
2728
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -44,6 +45,7 @@
4445
use Symfony\Component\Security\Core\Authorization\Strategy\PriorityStrategy;
4546
use Symfony\Component\Security\Core\Authorization\Strategy\UnanimousStrategy;
4647
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
48+
use Symfony\Component\Security\Core\User\ChainUserChecker;
4749
use Symfony\Component\Security\Core\User\ChainUserProvider;
4850
use Symfony\Component\Security\Core\User\UserCheckerInterface;
4951
use Symfony\Component\Security\Core\User\UserProviderInterface;
@@ -385,6 +387,10 @@ private function createFirewall(ContainerBuilder $container, string $id, array $
385387
]))
386388
;
387389

390+
// Register Firewall-specific chained user checker
391+
$container->register('security.user_checker.chain.'.$id, ChainUserChecker::class)
392+
->addArgument(new TaggedIteratorArgument('security.user_checker.'.$id));
393+
388394
// Register listeners
389395
$listeners = [];
390396
$listenerKeys = [];

0 commit comments

Comments
 (0)