Skip to content

Commit d320603

Browse files
feature #61046 [SecurityBundle] configuration for the storage service for the login throttling rate limiter (xabbuh)
This PR was merged into the 7.4 branch. Discussion ---------- [SecurityBundle] configuration for the storage service for the login throttling rate limiter | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | Fix #60744 | License | MIT Commits ------- 489a9c4 configuration for the storage service for the login throttling rate limiter
2 parents c83c34e + 489a9c4 commit d320603

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public function addConfiguration(NodeDefinition $builder): void
5555
->integerNode('max_attempts')->defaultValue(5)->end()
5656
->scalarNode('interval')->defaultValue('1 minute')->end()
5757
->scalarNode('lock_factory')->info('The service ID of the lock factory used by the login rate limiter (or null to disable locking).')->defaultNull()->end()
58+
->scalarNode('cache_pool')->info('The cache pool to use for storing the limiter state')->defaultValue('cache.rate_limiter')->end()
59+
->scalarNode('storage_service')->info('The service ID of a custom storage implementation, this precedes any configured "cache_pool"')->defaultNull()->end()
5860
->end();
5961
}
6062

@@ -70,6 +72,8 @@ public function createAuthenticator(ContainerBuilder $container, string $firewal
7072
'limit' => $config['max_attempts'],
7173
'interval' => $config['interval'],
7274
'lock_factory' => $config['lock_factory'],
75+
'cache_pool' => $config['cache_pool'],
76+
'storage_service' => $config['storage_service'],
7377
];
7478
$this->registerRateLimiter($container, $localId = '_login_local_'.$firewallName, $limiterOptions);
7579

@@ -93,9 +97,6 @@ public function createAuthenticator(ContainerBuilder $container, string $firewal
9397

9498
private function registerRateLimiter(ContainerBuilder $container, string $name, array $limiterConfig): void
9599
{
96-
// default configuration (when used by other DI extensions)
97-
$limiterConfig += ['lock_factory' => 'lock.factory', 'cache_pool' => 'cache.rate_limiter'];
98-
99100
$limiter = $container->setDefinition($limiterId = 'limiter.'.$name, new ChildDefinition('limiter'));
100101

101102
if (null !== $limiterConfig['lock_factory']) {

0 commit comments

Comments
 (0)