49
49
use Symfony \Component \PasswordHasher \Hasher \Pbkdf2PasswordHasher ;
50
50
use Symfony \Component \PasswordHasher \Hasher \PlaintextPasswordHasher ;
51
51
use Symfony \Component \PasswordHasher \Hasher \SodiumPasswordHasher ;
52
+ use Symfony \Component \Routing \Loader \ContainerLoader ;
52
53
use Symfony \Component \Security \Core \Authorization \Strategy \AffirmativeStrategy ;
53
54
use Symfony \Component \Security \Core \Authorization \Strategy \ConsensusStrategy ;
54
55
use Symfony \Component \Security \Core \Authorization \Strategy \PriorityStrategy ;
@@ -170,6 +171,11 @@ public function load(array $configs, ContainerBuilder $container)
170
171
}
171
172
172
173
$ this ->createFirewalls ($ config , $ container );
174
+
175
+ if (!$ container ::willBeAvailable ('symfony/routing ' , ContainerLoader::class, ['symfony/security/bundle ' ])) {
176
+ $ container ->removeDefinition ('security.route_loader.logout ' );
177
+ }
178
+
173
179
$ this ->createAuthorization ($ config , $ container );
174
180
$ this ->createRoleHierarchy ($ config , $ container );
175
181
@@ -307,7 +313,7 @@ private function createFirewalls(array $config, ContainerBuilder $container): vo
307
313
308
314
// load firewall map
309
315
$ mapDef = $ container ->getDefinition ('security.firewall.map ' );
310
- $ map = $ authenticationProviders = $ contextRefs = $ authenticators = [];
316
+ $ map = $ authenticationProviders = $ contextRefs = $ authenticators = $ configs = [];
311
317
foreach ($ firewalls as $ name => $ firewall ) {
312
318
if (isset ($ firewall ['user_checker ' ]) && 'security.user_checker ' !== $ firewall ['user_checker ' ]) {
313
319
$ customUserChecker = true ;
@@ -317,6 +323,8 @@ private function createFirewalls(array $config, ContainerBuilder $container): vo
317
323
318
324
[$ matcher , $ listeners , $ exceptionListener , $ logoutListener , $ firewallAuthenticators ] = $ this ->createFirewall ($ container , $ name , $ firewall , $ authenticationProviders , $ providerIds , $ configId );
319
325
326
+ $ configs [] = new Reference ($ configId );
327
+
320
328
if (!$ firewallAuthenticators ) {
321
329
$ authenticators [$ name ] = null ;
322
330
} else {
@@ -354,6 +362,11 @@ private function createFirewalls(array $config, ContainerBuilder $container): vo
354
362
if (!$ customUserChecker ) {
355
363
$ container ->setAlias (UserCheckerInterface::class, new Alias ('security.user_checker ' , false ));
356
364
}
365
+
366
+ $ container
367
+ ->getDefinition ('security.route_loader.logout ' )
368
+ ->replaceArgument (0 , new IteratorArgument ($ configs ))
369
+ ;
357
370
}
358
371
359
372
private function createFirewall (ContainerBuilder $ container , string $ id , array $ firewall , array &$ authenticationProviders , array $ providerIds , string $ configId ): array
0 commit comments