Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit be3a9a9

Browse files
committed
Applied left-over review comments from #33558
1 parent 6b682bf commit be3a9a9

File tree

6 files changed

+26
-18
lines changed

6 files changed

+26
-18
lines changed

src/Symfony/Component/Security/Http/Authentication/AuthenticatorManager.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function authenticateUser(UserInterface $user, AuthenticatorInterface $au
7777
public function supports(Request $request): ?bool
7878
{
7979
if (null !== $this->logger) {
80-
$context = ['firewall_key' => $this->firewallName];
80+
$context = ['firewall_name' => $this->firewallName];
8181

8282
if ($this->authenticators instanceof \Countable || \is_array($this->authenticators)) {
8383
$context['authenticators'] = \count($this->authenticators);
@@ -90,14 +90,14 @@ public function supports(Request $request): ?bool
9090
$lazy = true;
9191
foreach ($this->authenticators as $authenticator) {
9292
if (null !== $this->logger) {
93-
$this->logger->debug('Checking support on authenticator.', ['firewall_key' => $this->firewallName, 'authenticator' => \get_class($authenticator)]);
93+
$this->logger->debug('Checking support on authenticator.', ['firewall_name' => $this->firewallName, 'authenticator' => \get_class($authenticator)]);
9494
}
9595

9696
if (false !== $supports = $authenticator->supports($request)) {
9797
$authenticators[] = $authenticator;
9898
$lazy = $lazy && null === $supports;
9999
} elseif (null !== $this->logger) {
100-
$this->logger->debug('Authenticator does not support the request.', ['firewall_key' => $this->firewallName, 'authenticator' => \get_class($authenticator)]);
100+
$this->logger->debug('Authenticator does not support the request.', ['firewall_name' => $this->firewallName, 'authenticator' => \get_class($authenticator)]);
101101
}
102102
}
103103

src/Symfony/Component/Security/Http/Authentication/NoopAuthenticationManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*
2020
* This is used to not break AuthenticationChecker and ContextListener when
2121
* using the authenticator system. Once the authenticator system is no longer
22-
* experimental, this class can be used trigger deprecation notices.
22+
* experimental, this class can be used to trigger deprecation notices.
2323
*
2424
* @internal
2525
*

src/Symfony/Component/Security/Http/Authentication/UserAuthenticatorInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
interface UserAuthenticatorInterface
2525
{
2626
/**
27-
* Convenience method to manually login a user and return a
27+
* Convenience method to programmatically login a user and return a
2828
* Response *if any* for success.
2929
*/
3030
public function authenticateUser(UserInterface $user, AuthenticatorInterface $authenticator, Request $request): ?Response;

src/Symfony/Component/Security/Http/Authenticator/Passport/Badge/PasswordUpgradeBadge.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Security\Http\Authenticator\Passport\Badge;
1313

14+
use Symfony\Component\Security\Core\Exception\LogicException;
1415
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
1516

1617
/**
@@ -38,24 +39,23 @@ public function __construct(string $plaintextPassword, PasswordUpgraderInterface
3839
$this->passwordUpgrader = $passwordUpgrader;
3940
}
4041

41-
public function getPlaintextPassword(): string
42+
public function getAndErasePlaintextPassword(): string
4243
{
43-
return $this->plaintextPassword;
44+
$password = $this->plaintextPassword;
45+
if (null === $password) {
46+
throw new LogicException('The password is erased as another listener already used this badge.');
47+
}
48+
49+
$this->plaintextPassword = null;
50+
51+
return $password;
4452
}
4553

4654
public function getPasswordUpgrader(): PasswordUpgraderInterface
4755
{
4856
return $this->passwordUpgrader;
4957
}
5058

51-
/**
52-
* @internal
53-
*/
54-
public function eraseCredentials()
55-
{
56-
$this->plaintextPassword = null;
57-
}
58-
5959
public function isResolved(): bool
6060
{
6161
return true;

src/Symfony/Component/Security/Http/EventListener/PasswordMigratingListener.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Security\Http\EventListener;
413

514
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -32,8 +41,7 @@ public function onLoginSuccess(LoginSuccessEvent $event): void
3241

3342
/** @var PasswordUpgradeBadge $badge */
3443
$badge = $passport->getBadge(PasswordUpgradeBadge::class);
35-
$plaintextPassword = $badge->getPlaintextPassword();
36-
$badge->eraseCredentials();
44+
$plaintextPassword = $badge->getAndErasePlaintextPassword();
3745

3846
if ('' === $plaintextPassword) {
3947
return;

src/Symfony/Component/Security/Http/EventListener/SessionStrategyListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface;
1818

1919
/**
20-
* Migrates/invalidate the session after successful login.
20+
* Migrates/invalidates the session after successful login.
2121
*
2222
* This should be registered as subscriber to any "stateful" firewalls.
2323
*

0 commit comments

Comments
 (0)