Skip to content

Commit 0c1b0b3

Browse files
author
Robin Chalas
committed
[Security] Call AccessListener after LogoutListener
1 parent 9d0ff4f commit 0c1b0b3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
1717
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
1818
use Symfony\Component\HttpKernel\KernelEvents;
19+
use Symfony\Component\Security\Http\Firewall\AccessListener;
1920

2021
/**
2122
* Firewall uses a FirewallMap to register security listeners for the given
@@ -58,8 +59,16 @@ public function onKernelRequest(GetResponseEvent $event)
5859
$exceptionListener->register($this->dispatcher);
5960
}
6061

62+
$accessListener = null;
63+
6164
// initiate the listener chain
6265
foreach ($authenticationListeners as $listener) {
66+
if ($listener instanceof AccessListener) {
67+
$accessListener = $listener;
68+
69+
continue;
70+
}
71+
6372
$listener->handle($event);
6473

6574
if ($event->hasResponse()) {
@@ -70,6 +79,10 @@ public function onKernelRequest(GetResponseEvent $event)
7079
if (null !== $logoutListener) {
7180
$logoutListener->handle($event);
7281
}
82+
83+
if (!$event->hasResponse() && null !== $accessListener) {
84+
$accessListener->handle($event);
85+
}
7386
}
7487

7588
public function onKernelFinishRequest(FinishRequestEvent $event)

0 commit comments

Comments
 (0)