harden(rate-limiter): fail secure login scopes with cache fallback
This commit is contained in:
@@ -7,6 +7,7 @@ use MintyPHP\Repository\Security\RateLimitRepositoryInterface;
|
||||
class SecurityServicesFactory
|
||||
{
|
||||
private ?RateLimiterService $rateLimiterService = null;
|
||||
private ?RateLimiterFallbackGateway $rateLimiterFallbackGateway = null;
|
||||
|
||||
public function __construct(
|
||||
private readonly SecurityRepositoryFactory $securityRepositoryFactory
|
||||
@@ -20,6 +21,14 @@ class SecurityServicesFactory
|
||||
|
||||
public function createRateLimiterService(): RateLimiterService
|
||||
{
|
||||
return $this->rateLimiterService ??= new RateLimiterService($this->createRateLimitRepository());
|
||||
return $this->rateLimiterService ??= new RateLimiterService(
|
||||
$this->createRateLimitRepository(),
|
||||
$this->createRateLimiterFallbackGateway()
|
||||
);
|
||||
}
|
||||
|
||||
public function createRateLimiterFallbackGateway(): RateLimiterFallbackGateway
|
||||
{
|
||||
return $this->rateLimiterFallbackGateway ??= new RateLimiterFallbackGateway();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user