Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public function addConfiguration(NodeDefinition $builder): void
->integerNode('max_attempts')->defaultValue(5)->end()
->scalarNode('interval')->defaultValue('1 minute')->end()
->scalarNode('lock_factory')->info('The service ID of the lock factory used by the login rate limiter (or null to disable locking).')->defaultNull()->end()
->scalarNode('cache_pool')->info('The cache pool to use for storing the limiter state')->defaultValue('cache.rate_limiter')->end()
->scalarNode('storage_service')->info('The service ID of a custom storage implementation, this precedes any configured "cache_pool"')->defaultNull()->end()
Comment on lines +58 to +59
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use the recently added stringNode() instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added in #61502

->end();
}

Expand All @@ -70,6 +72,8 @@ public function createAuthenticator(ContainerBuilder $container, string $firewal
'limit' => $config['max_attempts'],
'interval' => $config['interval'],
'lock_factory' => $config['lock_factory'],
'cache_pool' => $config['cache_pool'],
'storage_service' => $config['storage_service'],
];
$this->registerRateLimiter($container, $localId = '_login_local_'.$firewallName, $limiterOptions);

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

private function registerRateLimiter(ContainerBuilder $container, string $name, array $limiterConfig): void
{
// default configuration (when used by other DI extensions)
$limiterConfig += ['lock_factory' => 'lock.factory', 'cache_pool' => 'cache.rate_limiter'];

$limiter = $container->setDefinition($limiterId = 'limiter.'.$name, new ChildDefinition('limiter'));

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