From b1c736539354d856baa13f1007244616d2ff37f5 Mon Sep 17 00:00:00 2001 From: Danny van Wijk Date: Thu, 21 Nov 2024 13:25:19 +0100 Subject: [PATCH] Remove session security listener if values are not enabled --- .../DependencyInjection/KunstmaanAdminExtension.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Kunstmaan/AdminBundle/DependencyInjection/KunstmaanAdminExtension.php b/src/Kunstmaan/AdminBundle/DependencyInjection/KunstmaanAdminExtension.php index ff97b1c7b3..43e7653cb8 100644 --- a/src/Kunstmaan/AdminBundle/DependencyInjection/KunstmaanAdminExtension.php +++ b/src/Kunstmaan/AdminBundle/DependencyInjection/KunstmaanAdminExtension.php @@ -79,6 +79,7 @@ public function load(array $configs, ContainerBuilder $container): void } $this->registerExceptionLoggingConfiguration($config['exception_logging'], $container); + $this->removeSessionSecurityListener($config, $container); $container->setParameter('kunstmaan_admin.default_locale', $config['default_locale']); $container->setParameter('kunstmaan_admin.website_title', $config['website_title']); @@ -137,6 +138,15 @@ private function registerExceptionLoggingConfiguration(array $config, ContainerB $definition->setArgument(2, false); } + private function removeSessionSecurityListener(array $config, ContainerBuilder $container): void + { + if ($config['session_security']['ip_check'] || $config['session_security']['user_agent_check']) { + return; + } + + $container->removeDefinition('kunstmaan_admin.session_security'); + } + private function configureAuthentication(array $config, ContainerBuilder $container, LoaderInterface $loader): void { $container->setParameter('kunstmaan_admin.enable_new_cms_authentication', true);