Skip to content

Commit a38d1cd

Browse files
glutamattfabpot
authored andcommitted
bug #10242 Missing checkPreAuth from RememberMeAuthenticationProvider
1 parent bc8ee6f commit a38d1cd

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->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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy