Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e0d1867

Browse filesBrowse files
committed
Handle consecutive supports() calls in the RememberMeAuthenticator
1 parent c453c3d commit e0d1867
Copy full SHA for e0d1867

File tree

Expand file treeCollapse file tree

2 files changed

+15
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+15
-0
lines changed

‎src/Symfony/Component/Security/Http/Authenticator/RememberMeAuthenticator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Authenticator/RememberMeAuthenticator.php
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ public function supports(Request $request): ?bool
5656
return false;
5757
}
5858

59+
// if the attribute is set, this is a lazy firewall. The previous
60+
// support call already indicated support, so return null and avoid
61+
// recreating the cookie
62+
if ($request->attributes->has('_remember_me_token')) {
63+
return null;
64+
}
65+
5966
$token = $this->rememberMeServices->autoLogin($request);
6067
if (null === $token) {
6168
return false;

‎src/Symfony/Component/Security/Http/Tests/Authenticator/RememberMeAuthenticatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Tests/Authenticator/RememberMeAuthenticatorTest.php
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ public function provideSupportsData()
6060
yield [$this->createMock(TokenInterface::class), null];
6161
}
6262

63+
public function testConsecutiveSupportsCalls()
64+
{
65+
$this->rememberMeServices->expects($this->once())->method('autoLogin')->with($this->request)->willReturn($this->createMock(TokenInterface::class));
66+
67+
$this->assertNull($this->authenticator->supports($this->request));
68+
$this->assertNull($this->authenticator->supports($this->request));
69+
}
70+
6371
public function testAuthenticate()
6472
{
6573
$this->request->attributes->set('_remember_me_token', new RememberMeToken($user = new User('wouter', 'test'), 'main', 'secret'));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.