GuardTokenInterface
extends
TokenInterface
in
A marker interface that both guard tokens implement.
Any tokens passed to GuardAuthenticationProvider (i.e. any tokens that are handled by the guard auth system) must implement this interface.
Tags
Table of Contents
- __toString() : string
- Returns a string representation of the Token.
- eraseCredentials() : mixed
- Removes sensitive information from the token.
- getAttribute() : mixed
- Returns an attribute value.
- getAttributes() : array<string|int, mixed>
- Returns the token attributes.
- getCredentials() : mixed
- Returns the user credentials.
- getRoles() : array<string|int, Role>
- Returns the user roles.
- getUser() : string|Stringable|UserInterface
- Returns a user representation.
- getUsername() : string
- Returns the username.
- hasAttribute() : bool
- Returns true if the attribute exists.
- isAuthenticated() : bool
- Returns whether the user is authenticated or not.
- setAttribute() : mixed
- Sets an attribute.
- setAttributes() : mixed
- Sets the token attributes.
- setAuthenticated() : mixed
- Sets the authenticated flag.
- setUser() : mixed
- Sets the user in the token.
Methods
__toString()
Returns a string representation of the Token.
public
__toString() : string
This is only to be used for debugging purposes.
Return values
string —eraseCredentials()
Removes sensitive information from the token.
public
eraseCredentials() : mixed
Return values
mixed —getAttribute()
Returns an attribute value.
public
getAttribute(string $name) : mixed
Parameters
- $name : string
-
The attribute name
Tags
Return values
mixed —The attribute value
getAttributes()
Returns the token attributes.
public
getAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed> —The token attributes
getCredentials()
Returns the user credentials.
public
getCredentials() : mixed
Return values
mixed —The user credentials
getRoles()
Returns the user roles.
public
getRoles() : array<string|int, Role>
Tags
Return values
array<string|int, Role> —An array of Role instances
getUser()
Returns a user representation.
public
getUser() : string|Stringable|UserInterface
Tags
Return values
string|Stringable|UserInterface —getUsername()
Returns the username.
public
getUsername() : string
Return values
string —hasAttribute()
Returns true if the attribute exists.
public
hasAttribute(string $name) : bool
Parameters
- $name : string
-
The attribute name
Return values
bool —true if the attribute exists, false otherwise
isAuthenticated()
Returns whether the user is authenticated or not.
public
isAuthenticated() : bool
Return values
bool —true if the token has been authenticated, false otherwise
setAttribute()
Sets an attribute.
public
setAttribute(string $name, mixed $value) : mixed
Parameters
- $name : string
-
The attribute name
- $value : mixed
-
The attribute value
Return values
mixed —setAttributes()
Sets the token attributes.
public
setAttributes(array<string|int, mixed> $attributes) : mixed
Parameters
- $attributes : array<string|int, mixed>
-
The token attributes
Return values
mixed —setAuthenticated()
Sets the authenticated flag.
public
setAuthenticated(bool $isAuthenticated) : mixed
Parameters
- $isAuthenticated : bool
-
The authenticated flag
Return values
mixed —setUser()
Sets the user in the token.
public
setUser(string|Stringable|UserInterface $user) : mixed
The user can be a UserInterface instance, or an object implementing a __toString method or the username as a regular string.
Parameters
- $user : string|Stringable|UserInterface