SwitchUserToken
extends UsernamePasswordToken
in package
Token representing a user who temporarily impersonates another one.
Tags
Table of Contents
Properties
- $attributes : array<string|int, mixed>
- $firewallName : string
- $originalToken : mixed
- $originatedFromUri : string|null
- $roleNames : array<string|int, mixed>
- $user : mixed
Methods
- __construct() : mixed
- __serialize() : array<string|int, mixed>
- Returns all the necessary state of the object for serialization purposes.
- __toString() : string
- Returns a string representation of the Token.
- __unserialize() : void
- Restores the object state from an array given by __serialize().
- eraseCredentials() : mixed
- Removes sensitive information from the token.
- getAttribute() : mixed
- getAttributes() : array<string|int, mixed>
- getFirewallName() : string
- getOriginalToken() : TokenInterface
- getOriginatedFromUri() : string|null
- getRoleNames() : array<string|int, string>
- Returns the user roles.
- getUser() : UserInterface|null
- Returns a user representation.
- getUserIdentifier() : string
- Returns the user identifier used during authentication (e.g. a user's email address or username).
- hasAttribute() : bool
- setAttribute() : mixed
- setAttributes() : mixed
- setUser() : mixed
- Sets the authenticated user in the token.
Properties
$attributes
private
array<string|int, mixed>
$attributes
= []
$firewallName
private
string
$firewallName
$originalToken
private
mixed
$originalToken
$originatedFromUri
private
string|null
$originatedFromUri
= null
$roleNames
private
array<string|int, mixed>
$roleNames
= []
$user
private
mixed
$user
= null
Methods
__construct()
public
__construct(UserInterface $user, string $firewallName, array<string|int, mixed> $roles, TokenInterface $originalToken[, $originatedFromUri = null ]) : mixed
Parameters
- $user : UserInterface
-
The username (like a nickname, email address, etc.), or a UserInterface instance or an object implementing a __toString method
- $firewallName : string
- $roles : array<string|int, mixed>
-
An array of roles
- $originalToken : TokenInterface
- $originatedFromUri : = null
-
The URI where was the user at the switch
Tags
__serialize()
Returns all the necessary state of the object for serialization purposes.
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__toString()
Returns a string representation of the Token.
public
__toString() : string
This is only to be used for debugging purposes.
Return values
string__unserialize()
Restores the object state from an array given by __serialize().
public
__unserialize(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
eraseCredentials()
Removes sensitive information from the token.
public
eraseCredentials() : mixed
getAttribute()
public
getAttribute(string $name) : mixed
Parameters
- $name : string
getAttributes()
public
getAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getFirewallName()
public
getFirewallName() : string
Return values
stringgetOriginalToken()
public
getOriginalToken() : TokenInterface
Return values
TokenInterfacegetOriginatedFromUri()
public
getOriginatedFromUri() : string|null
Return values
string|nullgetRoleNames()
Returns the user roles.
public
getRoleNames() : array<string|int, string>
Return values
array<string|int, string>getUser()
Returns a user representation.
public
getUser() : UserInterface|null
Return values
UserInterface|nullgetUserIdentifier()
Returns the user identifier used during authentication (e.g. a user's email address or username).
public
getUserIdentifier() : string
Return values
stringhasAttribute()
public
hasAttribute(string $name) : bool
Parameters
- $name : string
Return values
boolsetAttribute()
public
setAttribute(string $name, mixed $value) : mixed
Parameters
- $name : string
- $value : mixed
setAttributes()
public
setAttributes(array<string|int, mixed> $attributes) : mixed
Parameters
- $attributes : array<string|int, mixed>
-
The token attributes
setUser()
Sets the authenticated user in the token.
public
setUser(UserInterface $user) : mixed
Parameters
- $user : UserInterface