[Security] fix check for empty usernames

This commit is contained in:
Christian Flothmann 2015-07-21 20:37:10 +02:00
parent 510b2d2de6
commit 6585fe45a2
4 changed files with 4 additions and 4 deletions

View File

@ -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)) {

View File

@ -62,7 +62,7 @@ abstract class UserAuthenticationProvider implements AuthenticationProviderInter
}
$username = $token->getUsername();
if (empty($username)) {
if ('' === $username || null === $username) {
$username = 'NONE_PROVIDED';
}

View File

@ -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)) {

View File

@ -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.');
}