8000 bug #11058 [Security] bug #10242 Missing checkPreAuth from RememberMe… · symfony/symfony@a05a95c · GitHub
[go: up one dir, main page]

Skip to content

Commit a05a95c

Browse files
committed
bug #11058 [Security] bug #10242 Missing checkPreAuth from RememberMeAuthenticationProvider (glutamatt)
This PR was submitted for the 2.4 branch but it was merged into the 2.3 branch instead (closes #11058). Discussion ---------- [Security] bug #10242 Missing checkPreAuth from RememberMeAuthenticationProvider | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #10242 | License | MIT [Security] fixed missing call to UserChecker::checkPreAuth edit : after the discution with @hellomedia , i replaced postcheck with precheck glutamatt@e0730e0#commitcomment-6580764 Commits ------- a38d1cd bug #10242 Missing checkPreAuth from RememberMeAuthenticationProvider
2 parents bc8ee6f + a38d1cd commit a05a95c

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

src/Symfony/Component/Security/Core/Authentication/Provider/RememberMeAuthenticationProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function authenticate(TokenInterface $token)
5050
}
5151

5252
$user = $token->getUser();
53-
$this->userChecker->checkPostAuth($user);
53+
$this->userChecker->checkPreAuth($user);
5454

5555
$authenticatedToken = new RememberMeToken($user, $this->providerKey, $this->key);
5656
$authenticatedToken->setAttributes($token->getAttributes());

src/Symfony/Component/Security/Tests/Core/Authentication/Provider/RememberMeAuthenticationProviderTest.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Symfony\Component\Security\Tests\Core\Authentication\Provider;
1313

1414
use Symfony\Component\Security\Core\Authentication\Provider\RememberMeAuthenticationProvider;
15-
use Symfony\Component\Security\Core\Exception\AccountExpiredException;
15+
use Symfony\Component\Security\Core\Exception\DisabledException;
1616
use Symfony\Component\Security\Core\Role\Role;
1717

1818
class RememberMeAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
@@ -45,15 +45,14 @@ public function testAuthenticateWhenKeysDoNotMatch()
4545
}
4646

4747
/**
48-
* @expectedException \Symfony\Component\Security\Core\Exception\AccountExpiredException
48+
* @expectedException \Symfony\Component\Security\Core\Exception\DisabledException
4949
*/
50-
public function testAuthenticateWhenPostChecksFails()
50+
public function testAuthenticateWhenPreChecksFails()
5151
{
5252
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
5353
$userChecker->expects($this->once())
54-
->method('checkPostAuth')
55-
->will($this->throwException(new AccountExpiredException()))
56-
;
54+
->method('checkPreAuth')
55+
->will($this->throwException(new DisabledException()));
5756

5857
$provider = $this->getProvider($userChecker);
5958

@@ -65,8 +64,7 @@ public function testAuthenticate()
6564
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
6665
$user->expects($this->exactly(2))
6766
->method('getRoles')
68-
->will($this->returnValue(array('ROLE_FOO')))
69-
;
67+
->will($this->returnValue(array('ROLE_FOO')));
7068

7169
$provider = $this->getProvider();
7270

@@ -86,16 +84,14 @@ protected function getSupportedToken($user = null, $key = 'test')
8684
$user
8785
->expects($this- 8000 >any())
8886
->method('getRoles')
89-
->will($this->returnValue(array()))
90-
;
87+
->will($this->returnValue(array()));
9188
}
9289

9390
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\RememberMeToken', array('getProviderKey'), array($user, 'foo', $key));
9491
$token
9592
->expects($this->once())
9693
->method('getProviderKey')
97-
->will($this->returnValue('foo'))
98-
;
94+
->will($this->returnValue('foo'));
9995

10096
return $token;
10197
}

0 commit comments

Comments
 (0)
0