Skip to content
This repository was archived by the owner on May 31, 2024. It is now read-only.

Commit 24e5cb2

Browse files
Merge branch '4.3' into 4.4
* 4.3: [Debug] fix ClassNotFoundFatalErrorHandler [Routing] Fix using a custom matcher & generator dumper class [Dotenv] Fixed infinite loop with missing quote followed by quoted value [HttpClient] Added missing sprintf [TwigBridge] button_widget now has its title attr translated even if its label = null or false [PhpUnitBridge] When using phpenv + phpenv-composer plugin, composer executable is wrapped into a bash script [Messenger] Added check if json_encode succeeded [Security] Prevent canceled remember-me cookie from being accepted [FrameworkBundle][TranslationUpdateCommand] Do not output positive feedback on stderr [Security\Guard] Fix missing typehints
2 parents daea69c + de0a85b commit 24e5cb2

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

Guard/Firewall/GuardAuthenticationListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class GuardAuthenticationListener extends AbstractListener implements ListenerIn
4949
* @param string $providerKey The provider (i.e. firewall) key
5050
* @param iterable|AuthenticatorInterface[] $guardAuthenticators The authenticators, with keys that match what's passed to GuardAuthenticationProvider
5151
*/
52-
public function __construct(GuardAuthenticatorHandler $guardHandler, AuthenticationManagerInterface $authenticationManager, string $providerKey, $guardAuthenticators, LoggerInterface $logger = null)
52+
public function __construct(GuardAuthenticatorHandler $guardHandler, AuthenticationManagerInterface $authenticationManager, string $providerKey, iterable $guardAuthenticators, LoggerInterface $logger = null)
5353
{
5454
if (empty($providerKey)) {
5555
throw new \InvalidArgumentException('$providerKey must not be empty.');

Guard/Provider/GuardAuthenticationProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class GuardAuthenticationProvider implements AuthenticationProviderInterface
4848
* @param iterable|AuthenticatorInterface[] $guardAuthenticators The authenticators, with keys that match what's passed to GuardAuthenticationListener
4949
* @param string $providerKey The provider (i.e. firewall) key
5050
*/
51-
public function __construct($guardAuthenticators, UserProviderInterface $userProvider, string $providerKey, UserCheckerInterface $userChecker, UserPasswordEncoderInterface $passwordEncoder = null)
51+
public function __construct(iterable $guardAuthenticators, UserProviderInterface $userProvider, string $providerKey, UserCheckerInterface $userChecker, UserPasswordEncoderInterface $passwordEncoder = null)
5252
{
5353
$this->guardAuthenticators = $guardAuthenticators;
5454
$this->userProvider = $userProvider;

Http/RememberMe/AbstractRememberMeServices.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ public function getSecret()
9494
*/
9595
final public function autoLogin(Request $request): ?TokenInterface
9696
{
97+
if (($cookie = $request->attributes->get(self::COOKIE_ATTR_NAME)) && null === $cookie->getValue()) {
98+
return null;
99+
}
100+
97101
if (null === $cookie = $request->cookies->get($this->options['name'])) {
98102
return null;
99103
}

Http/Tests/RememberMe/AbstractRememberMeServicesTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ public function testAutoLoginReturnsNullWhenNoCookie()
3939
$this->assertNull($service->autoLogin(new Request()));
4040
}
4141

42+
public function testAutoLoginReturnsNullAfterLoginFail()
43+
{
44+
$service = $this->getService(null, ['name' => 'foo', 'path' => null, 'domain' => null]);
45+
46+
$request = new Request();
47+
$request->cookies->set('foo', 'foo');
48+
49+
$service->loginFail($request);
50+
$this->assertNull($service->autoLogin($request));
51+
}
52+
4253
public function testAutoLoginThrowsExceptionWhenImplementationDoesNotReturnUserInterface()
4354
{
4455
$this->expectException('RuntimeException');

0 commit comments

Comments
 (0)