Documentation

InMemoryUser
in package
implements UserInterface, PasswordAuthenticatedUserInterface, EquatableInterface

FinalYes

UserInterface implementation used by the in-memory user provider.

This should not be used for anything else.

Tags
author

Robin Chalas robin.chalas@gmail.com

author

Fabien Potencier fabien@symfony.com

Table of Contents

Interfaces

UserInterface
Represents the interface that all user classes must implement.
PasswordAuthenticatedUserInterface
For users that can be authenticated using a password.
EquatableInterface
EquatableInterface used to test if two objects are equal in security and re-authentication context.

Properties

$enabled  : bool
$password  : string|null
$roles  : array<string|int, mixed>
$username  : string

Methods

__construct()  : mixed
__toString()  : string
eraseCredentials()  : mixed
Removes sensitive data from the user.
getPassword()  : string|null
Returns the hashed password used to authenticate the user.
getRoles()  : array<string|int, string>
Returns the roles granted to the user.
getUserIdentifier()  : string
Returns the identifier for this user (e.g. its username or email address).
isEnabled()  : bool
Checks whether the user is enabled.
isEqualTo()  : bool
The equality comparison should neither be done by referential equality nor by comparing identities (i.e. getId() === getId()).

Properties

Methods

__construct()

public __construct(string|null $username, string|null $password[, array<string|int, mixed> $roles = [] ][, bool $enabled = true ]) : mixed
Parameters
$username : string|null
$password : string|null
$roles : array<string|int, mixed> = []
$enabled : bool = true

__toString()

public __toString() : string
Return values
string

eraseCredentials()

Removes sensitive data from the user.

public eraseCredentials() : mixed

getPassword()

Returns the hashed password used to authenticate the user.

public getPassword() : string|null
Return values
string|null

getRoles()

Returns the roles granted to the user.

public getRoles() : array<string|int, string>
Return values
array<string|int, string>

getUserIdentifier()

Returns the identifier for this user (e.g. its username or email address).

public getUserIdentifier() : string
Return values
string

isEnabled()

Checks whether the user is enabled.

public isEnabled() : bool

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

Tags
see
DisabledException
Return values
bool

true if the user is enabled, false otherwise

isEqualTo()

The equality comparison should neither be done by referential equality nor by comparing identities (i.e. getId() === getId()).

public isEqualTo(UserInterface $user) : bool
Parameters
$user : UserInterface
Return values
bool

        
On this page

Search results