8000 Use a dedicated cache.rate_limiter cache pool · symfony/symfony@251c202 · GitHub
[go: up one dir, main page]

Skip to content

Commit 251c202

Browse files
committed
Use a dedicated cache.rate_limiter cache pool
Fixes #38365
1 parent 5dc562a commit 251c202

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1808,7 +1808,7 @@ private function addRateLimiterSection(ArrayNodeDefinition $rootNode)
18081808
-> 8000 ;end()
18091809
->scalarNode('cache_pool')
18101810
->info('The cache pool to use for storing the current limiter state')
1811-
->defaultValue('cache.app')
1811+
->defaultValue('cache.rate_limiter')
18121812
->end()
18131813
->scalarNode('storage_service')
18141814
->info('The service ID of a custom storage implementation, this precedes any configured "cache_pool"')

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2254,6 +2254,9 @@ private function registerRateLimiterConfiguration(array $config, ContainerBuilde
22542254

22552255
public static function registerRateLimiter(ContainerBuilder $container, string $name, array $limiterConfig)
22562256
{
2257+
// default configuration (when used by other DI extensions)
2258+
$limiterConfig += ['lock_factory' => 'lock.factory', 'cache_pool' => 'cache.rate_limiter'];
2259+
22572260
$limiter = $container->setDefinition($limiterId = 'limiter.'.$name, new ChildDefinition('limiter'));
22582261

22592262
$limiter->addArgument(new Reference($limiterConfig['lock_factory']));

src/Symfony/Bundle/FrameworkBundle/Resources/config/rate_limiter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515

1616
return static function (ContainerConfigurator $container) {
1717
$container->services()
18+
->set('cache.rate_limiter')
19+
->parent('cache.app')
20+
->tag('cache.pool')
21+
1822
->set('limiter', Limiter::class)
1923
->abstract()
2024
->args([

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ public function createAuthenticator(ContainerBuilder $container, string $firewal
7676
'strategy' => 'fixed_window',
7777
'limit' => $config['max_attempts'],
7878
'interval' => '1 minute',
79-
'lock_factory' => 'lock.factory',
80-
'cache_pool' => 'cache.app',
8179
];
8280
FrameworkExtension::registerRateLimiter($container, $localId = '_login_local_'.$firewallName, $limiterOptions);
8381

0 commit comments

Comments
 (0)
0