AdvancedUserInterface deprecated
interface AdvancedUserInterface implements UserInterface
deprecated since Symfony 4.1
Adds extra features to a user class related to account status flags.
This interface can be implemented in place of UserInterface if you'd like the authentication system to consider different account status flags during authentication. If any of the methods in this interface return false, authentication will fail.
If you need to perform custom logic for any of these situations, then you will need to register an exception listener and watch for the specific exception instances thrown in each case. All exceptions are a subclass of AccountStatusException
Methods
Returns the salt that was originally used to encode the password.
Checks whether the user's account has expired.
Checks whether the user is locked.
Checks whether the user's credentials (password) has expired.
Checks whether the user is enabled.
Details
(Role|string)[]
getRoles()
Returns the roles granted to the user.
public function getRoles() { return array('ROLE_USER'); }
Alternatively, the roles might be stored on a roles
property,
and populated in any number of different ways when the user object
is created.
string
getPassword()
Returns the password used to authenticate the user.
This should be the encoded password. On authentication, a plain-text password will be salted, encoded, and then compared to this value.
string|null
getSalt()
Returns the salt that was originally used to encode the password.
This can return null if the password was not encoded using a salt.
eraseCredentials()
Removes sensitive data from the user.
This is important if, at any given point, sensitive information like the plain-text password is stored on this object.
bool
isAccountNonExpired()
Checks whether the user's account has expired.
Internally, if this method returns false, the authentication system will throw an AccountExpiredException and prevent login.
bool
isAccountNonLocked()
Checks whether the user is locked.
Internally, if this method returns false, the authentication system will throw a LockedException and prevent login.