summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2013-12-31 14:43:26 +0100
committerFabien Potencier <fabien.potencier@gmail.com>2013-12-31 14:43:26 +0100
commitf8dff63f4919ac33ccda41987ed5f0f114b3a0b7 (patch)
tree2aceeef6454a1454a75511c11444fd1473e4500c
parent763b54967bf8bd0798bab530df38ec6b695d2d49 (diff)
parentf3427fa7d44637866e038bf49ae336509e99800b (diff)
downloadsymfony-security-f8dff63f4919ac33ccda41987ed5f0f114b3a0b7.zip
symfony-security-f8dff63f4919ac33ccda41987ed5f0f114b3a0b7.tar.gz
symfony-security-f8dff63f4919ac33ccda41987ed5f0f114b3a0b7.tar.bz2
Merge branch '2.3' into 2.4
* 2.3: [Security] fixed pre/post authentication checks Updated lithuanian validator translation: changed vartotojas to naudotojas as it is more proper term. Fixed CSS [HttpFoundation] Throw proper exception when invalid data is passed to JsonResponse class addressed == -> === suggestion Fixed #9020 - Added support for collections in service#parameters fixes PSR-0 issues in tests adjusted behavior to always copy override on url files Skips test that need full lib-intl. Conflicts: src/Symfony/Component/Security/Acl/Tests/Permission/MaskBuilderTest.php src/Symfony/Component/Security/Core/Tests/Authentication/Token/RememerMeTokenTest.php src/Symfony/Component/Security/Core/Tests/User/AccountCheckerTest.php src/Symfony/Component/Security/Core/Tests/User/InMemoryProviderTest.php src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php src/Symfony/Component/Security/Tests/Core/Authentication/Token/RememberMeTokenTest.php src/Symfony/Component/Security/Tests/Core/Authentication/Token/RememerMeTokenTest.php src/Symfony/Component/Security/Tests/Core/User/AccountCheckerTest.php src/Symfony/Component/Security/Tests/Core/User/InMemoryProviderTest.php src/Symfony/Component/Security/Tests/Core/User/InMemoryUserProviderTest.php src/Symfony/Component/Security/Tests/Core/User/UserCheckerTest.php
-rw-r--r--Acl/Tests/Domain/EntryTest.php2
-rw-r--r--Acl/Tests/Permission/MaskBuilderTest.php2
-rw-r--r--Core/User/UserChecker.php32
-rw-r--r--Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php2
-rw-r--r--Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php2
-rw-r--r--Tests/Core/Authentication/Token/RememberMeTokenTest.php (renamed from Core/Tests/Authentication/Token/RememerMeTokenTest.php)2
-rw-r--r--Tests/Core/User/InMemoryUserProviderTest.php (renamed from Core/Tests/User/InMemoryProviderTest.php)2
-rw-r--r--Tests/Core/User/UserCheckerTest.php (renamed from Core/Tests/User/AccountCheckerTest.php)34
8 files changed, 39 insertions, 39 deletions
diff --git a/Acl/Tests/Domain/EntryTest.php b/Acl/Tests/Domain/EntryTest.php
index 88dd89e..55c8f0a 100644
--- a/Acl/Tests/Domain/EntryTest.php
+++ b/Acl/Tests/Domain/EntryTest.php
@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
-namespace Symfony\Component\Security\Tests\Domain;
+namespace Symfony\Component\Security\Tests\Acl\Domain;
use Symfony\Component\Security\Acl\Domain\Entry;
diff --git a/Acl/Tests/Permission/MaskBuilderTest.php b/Acl/Tests/Permission/MaskBuilderTest.php
index d9db824..8245669 100644
--- a/Acl/Tests/Permission/MaskBuilderTest.php
+++ b/Acl/Tests/Permission/MaskBuilderTest.php
@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
-namespace Symfony\Component\Security\Acl\Tests\Util;
+namespace Symfony\Component\Security\Acl\Tests\Permission;
use Symfony\Component\Security\Acl\Permission\MaskBuilder;
diff --git a/Core/User/UserChecker.php b/Core/User/UserChecker.php
index 8dde3a6..ac577a3 100644
--- a/Core/User/UserChecker.php
+++ b/Core/User/UserChecker.php
@@ -32,22 +32,6 @@ class UserChecker implements UserCheckerInterface
return;
}
- if (!$user->isCredentialsNonExpired()) {
- $ex = new CredentialsExpiredException('User credentials have expired.');
- $ex->setUser($user);
- throw $ex;
- }
- }
-
- /**
- * {@inheritdoc}
- */
- public function checkPostAuth(UserInterface $user)
- {
- if (!$user instanceof AdvancedUserInterface) {
- return;
- }
-
if (!$user->isAccountNonLocked()) {
$ex = new LockedException('User account is locked.');
$ex->setUser($user);
@@ -66,4 +50,20 @@ class UserChecker implements UserCheckerInterface
throw $ex;
}
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function checkPostAuth(UserInterface $user)
+ {
+ if (!$user instanceof AdvancedUserInterface) {
+ return;
+ }
+
+ if (!$user->isCredentialsNonExpired()) {
+ $ex = new CredentialsExpiredException('User credentials have expired.');
+ $ex->setUser($user);
+ throw $ex;
+ }
+ }
}
diff --git a/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php b/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php
index 097c926..15adcdf 100644
--- a/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php
+++ b/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php
@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
-namespace Symfony\Component\Security\Http\Tests;
+namespace Symfony\Component\Security\Http\Tests\Authentication;
use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler;
use Symfony\Component\Security\Core\SecurityContextInterface;
diff --git a/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php b/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php
index fa0ebd4..b775588 100644
--- a/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php
+++ b/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php
@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
-namespace Symfony\Component\Security\Http\Tests;
+namespace Symfony\Component\Security\Http\Tests\Authentication;
use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler;
diff --git a/Core/Tests/Authentication/Token/RememerMeTokenTest.php b/Tests/Core/Authentication/Token/RememberMeTokenTest.php
index 691f54c..cef3d28 100644
--- a/Core/Tests/Authentication/Token/RememerMeTokenTest.php
+++ b/Tests/Core/Authentication/Token/RememberMeTokenTest.php
@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
-namespace Symfony\Component\Security\Core\Tests\Authentication\Token;
+namespace Symfony\Component\Security\Tests\Core\Authentication\Token;
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
use Symfony\Component\Security\Core\Role\Role;
diff --git a/Core/Tests/User/InMemoryProviderTest.php b/Tests/Core/User/InMemoryUserProviderTest.php
index eccb596..275426c 100644
--- a/Core/Tests/User/InMemoryProviderTest.php
+++ b/Tests/Core/User/InMemoryUserProviderTest.php
@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
-namespace Symfony\Component\Security\Core\Tests\User;
+namespace Symfony\Component\Security\Tests\Core\User;
use Symfony\Component\Security\Core\User\InMemoryUserProvider;
use Symfony\Component\Security\Core\User\User;
diff --git a/Core/Tests/User/AccountCheckerTest.php b/Tests/Core/User/UserCheckerTest.php
index 8d5e203..dca6311 100644
--- a/Core/Tests/User/AccountCheckerTest.php
+++ b/Tests/Core/User/UserCheckerTest.php
@@ -9,50 +9,50 @@
* file that was distributed with this source code.
*/
-namespace Symfony\Component\Security\Core\Tests\User;
+namespace Symfony\Component\Security\Tests\Core\User;
use Symfony\Component\Security\Core\User\UserChecker;
class UserCheckerTest extends \PHPUnit_Framework_TestCase
{
- public function testCheckPreAuthNotAdvancedUserInterface()
+ public function testCheckPostAuthNotAdvancedUserInterface()
{
$checker = new UserChecker();
- $this->assertNull($checker->checkPreAuth($this->getMock('Symfony\Component\Security\Core\User\UserInterface')));
+ $this->assertNull($checker->checkPostAuth($this->getMock('Symfony\Component\Security\Core\User\UserInterface')));
}
- public function testCheckPreAuthPass()
+ public function testCheckPostAuthPass()
{
$checker = new UserChecker();
$account = $this->getMock('Symfony\Component\Security\Core\User\AdvancedUserInterface');
$account->expects($this->once())->method('isCredentialsNonExpired')->will($this->returnValue(true));
- $this->assertNull($checker->checkPreAuth($account));
+ $this->assertNull($checker->checkPostAuth($account));
}
/**
* @expectedException \Symfony\Component\Security\Core\Exception\CredentialsExpiredException
*/
- public function testCheckPreAuthCredentialsExpired()
+ public function testCheckPostAuthCredentialsExpired()
{
$checker = new UserChecker();
$account = $this->getMock('Symfony\Component\Security\Core\User\AdvancedUserInterface');
$account->expects($this->once())->method('isCredentialsNonExpired')->will($this->returnValue(false));
- $checker->checkPreAuth($account);
+ $checker->checkPostAuth($account);
}
- public function testCheckPostAuthNotAdvancedUserInterface()
+ public function testCheckPreAuthNotAdvancedUserInterface()
{
$checker = new UserChecker();
- $this->assertNull($checker->checkPostAuth($this->getMock('Symfony\Component\Security\Core\User\UserInterface')));
+ $this->assertNull($checker->checkPreAuth($this->getMock('Symfony\Component\Security\Core\User\UserInterface')));
}
- public function testCheckPostAuthPass()
+ public function testCheckPreAuthPass()
{
$checker = new UserChecker();
@@ -61,26 +61,26 @@ class UserCheckerTest extends \PHPUnit_Framework_TestCase
$account->expects($this->once())->method('isEnabled')->will($this->returnValue(true));
$account->expects($this->once())->method('isAccountNonExpired')->will($this->returnValue(true));
- $this->assertNull($checker->checkPostAuth($account));
+ $this->assertNull($checker->checkPreAuth($account));
}
/**
* @expectedException \Symfony\Component\Security\Core\Exception\LockedException
*/
- public function testCheckPostAuthAccountLocked()
+ public function testCheckPreAuthAccountLocked()
{
$checker = new UserChecker();
$account = $this->getMock('Symfony\Component\Security\Core\User\AdvancedUserInterface');
$account->expects($this->once())->method('isAccountNonLocked')->will($this->returnValue(false));
- $checker->checkPostAuth($account);
+ $checker->checkPreAuth($account);
}
/**
* @expectedException \Symfony\Component\Security\Core\Exception\DisabledException
*/
- public function testCheckPostAuthDisabled()
+ public function testCheckPreAuthDisabled()
{
$checker = new UserChecker();
@@ -88,13 +88,13 @@ class UserCheckerTest extends \PHPUnit_Framework_TestCase
$account->expects($this->once())->method('isAccountNonLocked')->will($this->returnValue(true));
$account->expects($this->once())->method('isEnabled')->will($this->returnValue(false));
- $checker->checkPostAuth($account);
+ $checker->checkPreAuth($account);
}
/**
* @expectedException \Symfony\Component\Security\Core\Exception\AccountExpiredException
*/
- public function testCheckPostAuthAccountExpired()
+ public function testCheckPreAuthAccountExpired()
{
$checker = new UserChecker();
@@ -103,6 +103,6 @@ class UserCheckerTest extends \PHPUnit_Framework_TestCase
$account->expects($this->once())->method('isEnabled')->will($this->returnValue(true));
$account->expects($this->once())->method('isAccountNonExpired')->will($this->returnValue(false));
- $checker->checkPostAuth($account);
+ $checker->checkPreAuth($account);
}
}