Skip to content

Commit de22db0

Browse files
committed
[Security] Backport type fixes
Signed-off-by: Alexander M. Turek <[email protected]>
1 parent ffb5c26 commit de22db0

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

Authentication/AuthenticatorManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class AuthenticatorManager implements AuthenticatorManagerInterface, UserAuthent
5555
private $requiredBadges;
5656

5757
/**
58-
* @param AuthenticatorInterface[] $authenticators
58+
* @param iterable<mixed, AuthenticatorInterface> $authenticators
5959
*/
6060
public function __construct(iterable $authenticators, TokenStorageInterface $tokenStorage, EventDispatcherInterface $eventDispatcher, string $firewallName, LoggerInterface $logger = null, bool $eraseCredentials = true, bool $hideUserNotFoundExceptions = true, array $requiredBadges = [])
6161
{

Logout/LogoutUrlGenerator.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ class LogoutUrlGenerator
2929
private $router;
3030
private $tokenStorage;
3131
private $listeners = [];
32-
private $currentFirewall;
32+
/** @var string|null */
33+
private $currentFirewallName;
34+
/** @var string|null */
35+
private $currentFirewallContext;
3336

3437
public function __construct(RequestStack $requestStack = null, UrlGeneratorInterface $router = null, TokenStorageInterface $tokenStorage = null)
3538
{
@@ -74,7 +77,8 @@ public function getLogoutUrl(string $key = null)
7477

7578
public function setCurrentFirewall(?string $key, string $context = null)
7679
{
77-
$this->currentFirewall = [$key, $context];
80+
$this->currentFirewallName = $key;
81+
$this->currentFirewallContext = $context;
7882
}
7983

8084
/**
@@ -130,7 +134,7 @@ private function getListener(?string $key): array
130134
if (null !== $this->tokenStorage) {
131135
$token = $this->tokenStorage->getToken();
132136

133-
// @deprecated since 5.4
137+
// @deprecated since Symfony 5.4
134138
if ($token instanceof AnonymousToken) {
135139
throw new \InvalidArgumentException('Unable to generate a logout url for an anonymous token.');
136140
}
@@ -151,14 +155,12 @@ private function getListener(?string $key): array
151155
}
152156

153157
// Fetch from injected current firewall information, if possible
154-
[$key, $context] = $this->currentFirewall;
155-
156-
if (isset($this->listeners[$key])) {
157-
return $this->listeners[$key];
158+
if (isset($this->listeners[$this->currentFirewallName])) {
159+
return $this->listeners[$this->currentFirewallName];
158160
}
159161

160162
foreach ($this->listeners as $listener) {
161-
if (isset($listener[4]) && $context === $listener[4]) {
163+
if (isset($listener[4]) && $this->currentFirewallContext === $listener[4]) {
162164
return $listener;
163165
}
164166
}

0 commit comments

Comments
 (0)