@@ -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
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 )
@@ -117,9 +92,4 @@ protected function callListeners(RequestEvent $event, iterable $listeners)
11792 }
11893 }
11994 }
120-
121- private function getListenerPriority (object $ logoutListener ): int
122- {
123- return $ logoutListener instanceof FirewallListenerInterface ? $ logoutListener ->getPriority () : 0 ;
124- }
12595}
0 commit comments