Skip to content

Commit 67a1324

Browse files
committed
Use one AuthenticatorManager per firewall
1 parent 5c3120d commit 67a1324

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Authentication/AuthenticatorManager.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,16 @@ class AuthenticatorManager implements AuthenticationManagerInterface
4040
private $authenticators;
4141
private $eventDispatcher;
4242
private $eraseCredentials;
43+
private $providerKey;
4344

4445
/**
4546
* @param AuthenticatorInterface[] $authenticators The authenticators, with keys that match what's passed to AuthenticatorManagerListener
4647
*/
47-
public function __construct(iterable $authenticators, EventDispatcherInterface $eventDispatcher, bool $eraseCredentials = true)
48+
public function __construct(iterable $authenticators, EventDispatcherInterface $eventDispatcher, string $providerKey, bool $eraseCredentials = true)
4849
{
4950
$this->authenticators = $authenticators;
5051
$this->eventDispatcher = $eventDispatcher;
52+
$this->providerKey = $providerKey;
5153
$this->eraseCredentials = $eraseCredentials;
5254
}
5355

Firewall/AuthenticatorManagerListener.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
*/
3434
class AuthenticatorManagerListener extends AbstractListener
3535
{
36-
private $authenticationManager;
36+
private $authenticatorManager;
3737
private $authenticatorHandler;
3838
private $authenticators;
3939
protected $providerKey;
@@ -45,7 +45,7 @@ class AuthenticatorManagerListener extends AbstractListener
4545
*/
4646
public function __construct(AuthenticationManagerInterface $authenticationManager, AuthenticatorHandler $authenticatorHandler, iterable $authenticators, string $providerKey, EventDispatcherInterface $eventDispatcher, ?LoggerInterface $logger = null)
4747
{
48-
$this->authenticationManager = $authenticationManager;
48+
$this->authenticatorManager = $authenticationManager;
4949
$this->authenticatorHandler = $authenticatorHandler;
5050
$this->authenticators = $authenticators;
5151
$this->providerKey = $providerKey;
@@ -157,7 +157,7 @@ private function executeAuthenticator(string $uniqueAuthenticatorKey, Authentica
157157
}
158158
// pass the token into the AuthenticationManager system
159159
// this indirectly calls AuthenticatorManager::authenticate()
160-
$token = $this->authenticationManager->authenticate($token);
160+
$token = $this->authenticatorManager->authenticate($token);
161161

162162
if (null !== $this->logger) {
163163
$this->logger->info('Authenticator successful!', ['token' => $token, 'authenticator' => \get_class($authenticator)]);

0 commit comments

Comments
 (0)