[Security] fix check for empty usernames
This commit is contained in:
parent
510b2d2de6
commit
6585fe45a2
@ -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)) {
|
||||
|
@ -62,7 +62,7 @@ abstract class UserAuthenticationProvider implements AuthenticationProviderInter
|
||||
}
|
||||
|
||||
$username = $token->getUsername();
|
||||
if (empty($username)) {
|
||||
if ('' === $username || null === $username) {
|
||||
$username = 'NONE_PROVIDED';
|
||||
}
|
||||
|
||||
|
@ -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)) {
|
||||
|
@ -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.');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user