diff --git a/src/Symfony/Bundle/SecurityBundle/Debug/TraceableFirewallListener.php b/src/Symfony/Bundle/SecurityBundle/Debug/TraceableFirewallListener.php index e82b47695bad9..9cb032adc8e93 100644 --- a/src/Symfony/Bundle/SecurityBundle/Debug/TraceableFirewallListener.php +++ b/src/Symfony/Bundle/SecurityBundle/Debug/TraceableFirewallListener.php @@ -17,13 +17,14 @@ use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\Security\Http\Authenticator\Debug\TraceableAuthenticatorManagerListener; use Symfony\Component\Security\Http\Firewall\FirewallListenerInterface; +use Symfony\Contracts\Service\ResetInterface; /** * Firewall collecting called security listeners and authenticators. * * @author Robin Chalas */ -final class TraceableFirewallListener extends FirewallListener +final class TraceableFirewallListener extends FirewallListener implements ResetInterface { private $wrappedListeners = []; private $authenticatorsInfo = []; @@ -38,6 +39,12 @@ public function getAuthenticatorsInfo(): array return $this->authenticatorsInfo; } + public function reset(): void + { + $this->wrappedListeners = []; + $this->authenticatorsInfo = []; + } + protected function callListeners(RequestEvent $event, iterable $listeners) { $wrappedListeners = []; diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php index c165024b68d0d..c19cae041bd10 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php @@ -544,6 +544,7 @@ private function createFirewall(ContainerBuilder $container, string $id, array $ ->register('debug.security.firewall.authenticator.'.$id, TraceableAuthenticatorManagerListener::class) ->setDecoratedService('security.firewall.authenticator.'.$id) ->setArguments([new Reference('debug.security.firewall.authenticator.'.$id.'.inner')]) + ->addTag('kernel.reset', ['method' => 'reset']) ; } diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_debug.php b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_debug.php index dc668b15e9ded..c98e3a6984672 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_debug.php +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_debug.php @@ -36,6 +36,7 @@ service('security.logout_url_generator'), ]) ->tag('kernel.event_subscriber') + ->tag('kernel.reset', ['method' => 'reset']) ->alias('security.firewall', 'debug.security.firewall') ; }; diff --git a/src/Symfony/Bundle/SecurityBundle/composer.json b/src/Symfony/Bundle/SecurityBundle/composer.json index dc3c62aeee0e6..9da183703a89e 100644 --- a/src/Symfony/Bundle/SecurityBundle/composer.json +++ b/src/Symfony/Bundle/SecurityBundle/composer.json @@ -26,10 +26,11 @@ "symfony/http-foundation": "^5.3|^6.0", "symfony/password-hasher": "^5.3|^6.0", "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.10|^2|^3", "symfony/security-core": "^5.4|^6.0", "symfony/security-csrf": "^4.4|^5.0|^6.0", "symfony/security-guard": "^5.3", - "symfony/security-http": "^5.4.20|~6.0.20|~6.1.12|^6.2.6" + "symfony/security-http": "^5.4.30|~6.0.20|~6.1.12|^6.2.6|^6.3.6" }, "require-dev": { "doctrine/annotations": "^1.10.4|^2", diff --git a/src/Symfony/Component/Security/Http/Authenticator/Debug/TraceableAuthenticatorManagerListener.php b/src/Symfony/Component/Security/Http/Authenticator/Debug/TraceableAuthenticatorManagerListener.php index 3286ce265dd81..e67e332286014 100644 --- a/src/Symfony/Component/Security/Http/Authenticator/Debug/TraceableAuthenticatorManagerListener.php +++ b/src/Symfony/Component/Security/Http/Authenticator/Debug/TraceableAuthenticatorManagerListener.php @@ -16,13 +16,14 @@ use Symfony\Component\Security\Http\Firewall\AbstractListener; use Symfony\Component\Security\Http\Firewall\AuthenticatorManagerListener; use Symfony\Component\VarDumper\Caster\ClassStub; +use Symfony\Contracts\Service\ResetInterface; /** * Decorates the AuthenticatorManagerListener to collect information about security authenticators. * * @author Robin Chalas */ -final class TraceableAuthenticatorManagerListener extends AbstractListener +final class TraceableAuthenticatorManagerListener extends AbstractListener implements ResetInterface { private $authenticationManagerListener; private $authenticatorsInfo = []; @@ -78,4 +79,9 @@ public function getAuthenticatorsInfo(): array { return $this->authenticatorsInfo; } + + public function reset(): void + { + $this->authenticatorsInfo = []; + } } diff --git a/src/Symfony/Component/Security/Http/composer.json b/src/Symfony/Component/Security/Http/composer.json index a5378b3ce5812..1b34814a58ccd 100644 --- a/src/Symfony/Component/Security/Http/composer.json +++ b/src/Symfony/Component/Security/Http/composer.json @@ -18,12 +18,13 @@ "require": { "php": ">=7.2.5", "symfony/deprecation-contracts": "^2.1|^3", - "symfony/security-core": "^5.4.19|~6.0.19|~6.1.11|^6.2.5", "symfony/http-foundation": "^5.3|^6.0", "symfony/http-kernel": "^5.3|^6.0", "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php80": "^1.16", - "symfony/property-access": "^4.4|^5.0|^6.0" + "symfony/property-access": "^4.4|^5.0|^6.0", + "symfony/service-contracts": "^1.10|^2|^3", + "symfony/security-core": "^5.4.19|~6.0.19|~6.1.11|^6.2.5" }, "require-dev": { "symfony/cache": "^4.4|^5.0|^6.0",