Skip to content

Commit bfc644c

Browse files
committed
[Security] Fix resetting traceable listeners
1 parent 8f432fa commit bfc644c

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

Debug/TraceableFirewallListener.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@
1717
use Symfony\Component\HttpKernel\Event\RequestEvent;
1818
use Symfony\Component\Security\Http\Authenticator\Debug\TraceableAuthenticatorManagerListener;
1919
use Symfony\Component\Security\Http\Firewall\FirewallListenerInterface;
20+
use Symfony\Contracts\Service\ResetInterface;
2021

2122
/**
2223
* Firewall collecting called security listeners and authenticators.
2324
*
2425
* @author Robin Chalas <[email protected]>
2526
*/
26-
final class TraceableFirewallListener extends FirewallListener
27+
final class TraceableFirewallListener extends FirewallListener implements ResetInterface
2728
{
2829
private $wrappedListeners = [];
2930
private $authenticatorsInfo = [];
@@ -38,6 +39,12 @@ public function getAuthenticatorsInfo(): array
3839
return $this->authenticatorsInfo;
3940
}
4041

42+
public function reset(): void
43+
{
44+
$this->wrappedListeners = [];
45+
$this->authenticatorsInfo = [];
46+
}
47+
4148
protected function callListeners(RequestEvent $event, iterable $listeners)
4249
{
4350
$wrappedListeners = [];

DependencyInjection/SecurityExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ private function createFirewall(ContainerBuilder $container, string $id, array $
544544
->register('debug.security.firewall.authenticator.'.$id, TraceableAuthenticatorManagerListener::class)
545545
->setDecoratedService('security.firewall.authenticator.'.$id)
546546
->setArguments([new Reference('debug.security.firewall.authenticator.'.$id.'.inner')])
547+
->addTag('kernel.reset', ['method' => 'reset'])
547548
;
548549
}
549550

Resources/config/security_debug.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
service('security.logout_url_generator'),
3737
])
3838
->tag('kernel.event_subscriber')
39+
->tag('kernel.reset', ['method' => 'reset'])
3940
->alias('security.firewall', 'debug.security.firewall')
4041
;
4142
};

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"symfony/security-core": "^5.4|^6.0",
3030
"symfony/security-csrf": "^4.4|^5.0|^6.0",
3131
"symfony/security-guard": "^5.3",
32-
"symfony/security-http": "^5.4.20|~6.0.20|~6.1.12|^6.2.6"
32+
"symfony/security-http": "^5.4.30|^6.3.6",
33+
"symfony/service-contracts": "^1.10|^2|^3"
3334
},
3435
"require-dev": {
3536
"doctrine/annotations": "^1.10.4|^2",

0 commit comments

Comments
 (0)