Skip to content

Commit 186ecc1

Browse files
committed
[Security] Improve exceptionwhen rate-limiter is not installed and throttling enabled
1 parent f06f2f0 commit 186ecc1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/LoginThrottlingFactory.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\DependencyInjection\ChildDefinition;
1818
use Symfony\Component\DependencyInjection\ContainerBuilder;
1919
use Symfony\Component\DependencyInjection\Reference;
20+
use Symfony\Component\RateLimiter\Limiter;
2021
use Symfony\Component\Security\Http\EventListener\LoginThrottlingListener;
2122

2223
/**
@@ -60,9 +61,13 @@ public function createAuthenticator(ContainerBuilder $container, string $firewal
6061
throw new \LogicException('Login throttling requires symfony/security-http:^5.2.');
6162
}
6263

64+
if (!class_exists(Limiter::class)) {
65+
throw new \LogicException('Login throttling requires symfony/rate-limiter to be installed and enabled.');
66+
}
67+
6368
if (!isset($config['limiter'])) {
6469
if (!class_exists(FrameworkExtension::class) || !method_exists(FrameworkExtension::class, 'registerRateLimiter')) {
65-
throw new \LogicException('You must either configure a rate limiter for "security.firewalls.'.$firewallName.'.login_throttling" or install symfony/framework-bundle:^5.2');
70+
throw new \LogicException('You must either configure a rate limiter for "security.firewalls.'.$firewallName.'.login_throttling" or install symfony/framework-bundle:^5.2.');
6671
}
6772

6873
FrameworkExtension::registerRateLimiter($container, $config['limiter'] = '_login_'.$firewallName, [

0 commit comments

Comments
 (0)