8000 Remove sorting of security listeners at runtime · symfony/symfony@29a751c · GitHub
[go: up one dir, main page]

Skip to content

Commit 29a751c

Browse files
committed
Remove sorting of security listeners at runtime
1 parent 732acf5 commit 29a751c

File tree

4 files changed

+5
-27
lines changed

4 files changed

+5
-27
lines changed

src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ private function createFirewall(ContainerBuilder $container, string $id, array $
416416
'csrf_token_id' => $firewall['logout']['csrf_token_id'],
417417
'logout_path' => $firewall['logout']['path'],
418418
]);
419+
$listeners[] = new Reference($logoutListenerId);
419420

420421
// add default logout listener
421422
if (isset($firewall['logout']['success_handler'])) {

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ public function testFirewalls()
206206
'security.channel_listener',
207207
'security.firewall.authenticator.secure',
208208
'security.authentication.switchuser_listener.secure',
209+
'security.logout_listener.secure',
209210
'security.access_listener',
210211
],
211212
[
@@ -335,6 +336,7 @@ public function testLegacyFirewalls()
335336
'security.authentication.listener.rememberme.secure',
336337
'security.authentication.listener.anonymous.secure',
337338
'security.authentication.switchuser_listener.secure',
339+
'security.logout_listener.secure',
338340
'security.access_listener',
339341
],
340342
[

src/Symfony/Component/Security/Http/Firewall.php

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -52,38 +52,13 @@ public function onKernelRequest(RequestEvent $event)
5252

5353
$authenticationListeners = $listeners[0];
5454
$exceptionListener = $listeners[1];
55-
$logoutListener = $listeners[2];
5655

5756
if (null !== $exceptionListener) {
5857
$this->exceptionListeners[$event->getRequest()] = $exceptionListener;
5958
$exceptionListener->register($this->dispatcher);
6059
}
6160
8000
62-
// Authentication listeners are pre-sorted by SortFirewallListenersPass
63-
$authenticationListeners = function () use ($authenticationListeners, $logoutListener) {
64-
if (null !== $logoutListener) {
65-
$logoutListenerPriority = $this->getListenerPriority($logoutListener);
66-
}
67-
68-
foreach ($authenticationListeners as $listener) {
69-
$listenerPriority = $this->getListenerPriority($listener);
70-
71-
// Yielding the LogoutListener at the correct position
72-
if (null !== $logoutListener && $listenerPriority < $logoutListenerPriority) {
73-
yield $logoutListener;
74-
$logoutListener = null;
75-
}
76-
77-
yield $listener;
78-
}
79-
80-
// When LogoutListener has the lowest priority of all listeners
81-
if (null !== $logoutListener) {
82-
yield $logoutListener;
83-
}
84-
};
85-
86-
$this->callListeners($event, $authenticationListeners());
61+
$this->callListeners($event, $authenticationListeners);
8762
}
8863

8964
public function onKernelFinishRequest(FinishRequestEvent $event)

src/Symfony/Component/Security/Http/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
},
3636
"conflict": {
3737
"symfony/event-dispatcher": "<4.3",
38-
"symfony/security-bundle": "<5.3",
38+
"symfony/security-bundle": "<5.4",
3939
"symfony/security-csrf": "<4.4"
4040
},
4141
"suggest": {

0 commit comments

Comments
 (0)
0