Symfony2 API
Interface

Symfony\Component\Security\Core\User\AdvancedUserInterface

interface AdvancedUserInterface implements UserInterface

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

Role[] getRoles()

Returns the roles granted to the user.

from UserInterface
string getPassword()

Returns the password used to authenticate the user.

from UserInterface
string getSalt()

Returns the salt that was originally used to encode the password.

from UserInterface
string getUsername()

Returns the username used to authenticate the user.

from UserInterface
void eraseCredentials()

Removes sensitive data from the user.

from UserInterface
Boolean isAccountNonExpired()

Checks whether the user's account has expired.

Boolean isAccountNonLocked()

Checks whether the user is locked.

Boolean isCredentialsNonExpired()

Checks whether the user's credentials (password) has expired.

Boolean isEnabled()

Checks whether the user is enabled.

Details

in UserInterface at line 50
public Role[] getRoles()

Returns the roles granted to the user.

<code>
public function getRoles()
{
return array('ROLE_USER');
}
</code>

Alternatively, the roles might be stored on a ``roles`` property,
and populated in any number of different ways when the user object
is created.

Return Value

Role[] The user roles

in UserInterface at line 60
public 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.

Return Value

string The password

in UserInterface at line 69
public string 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.

Return Value

string The salt

in UserInterface at line 76
public string getUsername()

Returns the username used to authenticate the user.

Return Value

string The username

in UserInterface at line 86
public void 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.

Return Value

void

at line 50
public Boolean 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.

Return Value

Boolean true if the user's account is non expired, false otherwise

See also

AccountExpiredException

at line 62
public Boolean isAccountNonLocked()

Checks whether the user is locked.

Internally, if this method returns false, the authentication system
will throw a LockedException and prevent login.

Return Value

Boolean true if the user is not locked, false otherwise

See also

LockedException

at line 74
public Boolean isCredentialsNonExpired()

Checks whether the user's credentials (password) has expired.

Internally, if this method returns false, the authentication system
will throw a CredentialsExpiredException and prevent login.

Return Value

Boolean true if the user's credentials are non expired, false otherwise

See also

CredentialsExpiredException

at line 86
public Boolean isEnabled()

Checks whether the user is enabled.

Internally, if this method returns false, the authentication system
will throw a DisabledException and prevent login.

Return Value

Boolean true if the user is enabled, false otherwise

See also

DisabledException