$this->
registerRateLimiter($container,
$globalId = '_login_global_'.
$firewallName,
$limiterOptions);
$container->
register($config['limiter'
] = 'security.login_throttling.'.
$firewallName.'.limiter', DefaultLoginRateLimiter::
class) ->
addArgument(new Reference('limiter.'.
$globalId)) ->
addArgument(new Reference('limiter.'.
$localId)) ->
addArgument('%kernel.secret%'
) ;
} $container ->
setDefinition('security.listener.login_throttling.'.
$firewallName,
new ChildDefinition('security.listener.login_throttling'
)) ->
replaceArgument(1,
new Reference($config['limiter'
])) ->
addTag('kernel.event_subscriber',
['dispatcher' => 'security.event_dispatcher.'.
$firewallName]);
return [];
} 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'
));