PHP Class Webiny\Component\Security\User\AbstractUser

You can optionally extend this class if you want to inherit the common getter functions.
Inheritance: implements Webiny\Component\Security\User\UserInterface, use trait Webiny\Component\StdLib\StdLibTrait
Afficher le fichier Open project: Webiny/Framework Class Usage Examples

Méthodes publiques

Méthode Description
authenticate ( Login $login, Firewall $firewall ) : boolean This method verifies the credentials of current user with the credentials provided from the Login object.
getAuthProviderName ( ) : string Returns the name of auth provider.
getPassword ( ) : string
getRoles ( ) : array Get a list of assigned roles
getUserProviderName ( ) : string Returns the name of user provider.
getUsername ( ) : string
hasRole ( string $role ) : boolean Check if current user has the defined role.
isAuthenticated ( ) : boolean Check if user is already authenticated.
isTokenValid ( TokenData $tokenData ) : boolean This method compares the $tokenData against the current user and returns true if users are identical, otherwise false is returned.
populate ( string $username, string $password, array $roles, boolean $isAuthenticated = false ) Populate the user object.
setAuthProviderName ( string $name ) Set the name of the auth provider.
setIsAuthenticated ( boolean $bool ) Sets the auth flag.
setRoles ( array $roles ) Sets the user roles.
setUserProviderName ( string $name ) Set the name of the user provider.

Method Details

authenticate() abstract public méthode

This method verifies the credentials of current user with the credentials provided from the Login object.
abstract public authenticate ( Login $login, Firewall $firewall ) : boolean
$login Webiny\Component\Security\Authentication\Providers\Login
$firewall Webiny\Component\Security\Authentication\Firewall
Résultat boolean Return true if credentials are valid, otherwise return false.

getAuthProviderName() public méthode

Returns the name of auth provider.
public getAuthProviderName ( ) : string
Résultat string

getPassword() public méthode

public getPassword ( ) : string
Résultat string Hashed password.

getRoles() public méthode

Get a list of assigned roles
public getRoles ( ) : array
Résultat array List of assigned roles.

getUserProviderName() public méthode

Returns the name of user provider.
public getUserProviderName ( ) : string
Résultat string

getUsername() public méthode

public getUsername ( ) : string
Résultat string Username.

hasRole() public méthode

Check if current user has the defined role.
public hasRole ( string $role ) : boolean
$role string Role name
Résultat boolean True if user has the role, otherwise false.

isAuthenticated() public méthode

Check if user is already authenticated.
public isAuthenticated ( ) : boolean
Résultat boolean True if user is authenticated, otherwise false.

isTokenValid() public méthode

This method compares the $tokenData against the current user and returns true if users are identical, otherwise false is returned.
public isTokenValid ( TokenData $tokenData ) : boolean
$tokenData Webiny\Component\Security\Token\TokenData
Résultat boolean

populate() public méthode

Populate the user object.
public populate ( string $username, string $password, array $roles, boolean $isAuthenticated = false )
$username string Username.
$password string Hashed password.
$roles array Array of the assigned roles.
$isAuthenticated boolean Boolean flag that tells us if user is already authenticated or not.

setAuthProviderName() public méthode

Set the name of the auth provider.
public setAuthProviderName ( string $name )
$name string

setIsAuthenticated() public méthode

Sets the auth flag.
public setIsAuthenticated ( boolean $bool )
$bool boolean

setRoles() public méthode

Sets the user roles.
public setRoles ( array $roles )
$roles array An array of Role instances.

setUserProviderName() public méthode

Set the name of the user provider.
public setUserProviderName ( string $name )
$name string