diff options
author | Christian Flothmann <christian.flothmann@xabbuh.de> | 2015-07-21 20:37:10 +0200 |
---|---|---|
committer | Christian Flothmann <christian.flothmann@xabbuh.de> | 2015-07-22 08:52:48 +0200 |
commit | 9aab3966fdabe3d6085ce5b1637503b74a7a5ce0 (patch) | |
tree | 995f75fd756190826c7a1c5c1cd9b4f2e16125d0 | |
parent | 1738333e52f972aabad7764e53722c9682354beb (diff) | |
download | symfony-security-9aab3966fdabe3d6085ce5b1637503b74a7a5ce0.zip symfony-security-9aab3966fdabe3d6085ce5b1637503b74a7a5ce0.tar.gz symfony-security-9aab3966fdabe3d6085ce5b1637503b74a7a5ce0.tar.bz2 |
[Security] fix check for empty usernames
-rw-r--r-- | Acl/Domain/UserSecurityIdentity.php | 2 | ||||
-rw-r--r-- | Core/Authentication/Provider/UserAuthenticationProvider.php | 2 | ||||
-rw-r--r-- | Core/Authentication/RememberMe/PersistentToken.php | 2 | ||||
-rw-r--r-- | Core/User/User.php | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/Acl/Domain/UserSecurityIdentity.php b/Acl/Domain/UserSecurityIdentity.php index 3bf277f..ea17c63 100644 --- a/Acl/Domain/UserSecurityIdentity.php +++ b/Acl/Domain/UserSecurityIdentity.php @@ -36,7 +36,7 @@ final class UserSecurityIdentity implements SecurityIdentityInterface */ public function __construct($username, $class) { - if (empty($username)) { + if ('' === $username || null === $username) { throw new \InvalidArgumentException('$username must not be empty.'); } if (empty($class)) { diff --git a/Core/Authentication/Provider/UserAuthenticationProvider.php b/Core/Authentication/Provider/UserAuthenticationProvider.php index b65a16b..a624ccf 100644 --- a/Core/Authentication/Provider/UserAuthenticationProvider.php +++ b/Core/Authentication/Provider/UserAuthenticationProvider.php @@ -62,7 +62,7 @@ abstract class UserAuthenticationProvider implements AuthenticationProviderInter } $username = $token->getUsername(); - if (empty($username)) { + if ('' === $username || null === $username) { $username = 'NONE_PROVIDED'; } diff --git a/Core/Authentication/RememberMe/PersistentToken.php b/Core/Authentication/RememberMe/PersistentToken.php index 92fcb4f..d85572d 100644 --- a/Core/Authentication/RememberMe/PersistentToken.php +++ b/Core/Authentication/RememberMe/PersistentToken.php @@ -40,7 +40,7 @@ final class PersistentToken implements PersistentTokenInterface if (empty($class)) { throw new \InvalidArgumentException('$class must not be empty.'); } - if (empty($username)) { + if ('' === $username || null === $username) { throw new \InvalidArgumentException('$username must not be empty.'); } if (empty($series)) { diff --git a/Core/User/User.php b/Core/User/User.php index ea2c6a4..86f1acd 100644 --- a/Core/User/User.php +++ b/Core/User/User.php @@ -30,7 +30,7 @@ final class User implements AdvancedUserInterface public function __construct($username, $password, array $roles = array(), $enabled = true, $userNonExpired = true, $credentialsNonExpired = true, $userNonLocked = true) { - if (empty($username)) { + if ('' === $username || null === $username) { throw new \InvalidArgumentException('The username cannot be empty.'); } |