Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ private function createFirewall(ContainerBuilder $container, string $id, array $
'csrf_token_id' => $firewall['logout']['csrf_token_id'],
'logout_path' => $firewall['logout']['path'],
]);
$listeners[] = new Reference($logoutListenerId);

$logoutSuccessListenerId = 'security.logout.listener.default.'.$id;
$container->setDefinition($logoutSuccessListenerId, new ChildDefinition('security.logout.listener.default'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ public function testFirewalls()
'security.channel_listener',
'security.firewall.authenticator.secure',
'security.authentication.switchuser_listener.secure',
'security.logout_listener.secure',
'security.access_listener',
],
[
Expand Down
27 changes: 1 addition & 26 deletions src/Symfony/Component/Security/Http/Firewall.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,38 +52,13 @@ public function onKernelRequest(RequestEvent $event)

$authenticationListeners = $listeners[0];
$exceptionListener = $listeners[1];
$logoutListener = $listeners[2];

if (null !== $exceptionListener) {
$this->exceptionListeners[$event->getRequest()] = $exceptionListener;
$exceptionListener->register($this->dispatcher);
}

// Authentication listeners are pre-sorted by SortFirewallListenersPass
$authenticationListeners = function () use ($authenticationListeners, $logoutListener) {
if (null !== $logoutListener) {
$logoutListenerPriority = $this->getListenerPriority($logoutListener);
}

foreach ($authenticationListeners as $listener) {
$listenerPriority = $this->getListenerPriority($listener);

// Yielding the LogoutListener at the correct position
if (null !== $logoutListener && $listenerPriority < $logoutListenerPriority) {
yield $logoutListener;
$logoutListener = null;
}

yield $listener;
}

// When LogoutListener has the lowest priority of all listeners
if (null !== $logoutListener) {
yield $logoutListener;
}
};

$this->callListeners($event, $authenticationListeners());
$this->callListeners($event, $authenticationListeners);
}

public function onKernelFinishRequest(FinishRequestEvent $event)
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Security/Http/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"conflict": {
"symfony/event-dispatcher": "<5.4",
"symfony/security-bundle": "<5.4",
"symfony/security-bundle": "<6.0",
"symfony/security-csrf": "<5.4"
},
"suggest": {
Expand Down