interface TokenInterface implementsStringable

TokenInterface is the interface for the user authentication information.

Methods

string
__toString()

Returns a string representation of the Token.

string
getUserIdentifier()

Returns the user identifier used during authentication (e.g. a user's email address or username).

array
getRoleNames()

Returns the user roles.

UserInterface|null
getUser()

Returns a user representation.

void
setUser(UserInterface$user)

Sets the authenticated user in the token.

void
eraseCredentials()

Removes sensitive information from the token.

array
getAttributes()

No description

void
setAttributes(array$attributes)

No description

bool
hasAttribute(string$name)

No description

mixed
getAttribute(string$name)

No description

void
setAttribute(string$name,mixed$value)

No description

array
__serialize()

Returns all the necessary state of the object for serialization purposes.

void
__unserialize(array$data)

Restores the object state from an array given by __serialize().

Details

string __toString()

Returns a string representation of the Token.

This is only to be used for debugging purposes.

Return Value

string

string getUserIdentifier()

Returns the user identifier used during authentication (e.g. a user's email address or username).

Return Value

string

array getRoleNames()

Returns the user roles.

Return Value

array

UserInterface|null getUser()

Returns a user representation.

Return Value

UserInterface|null

See also

AbstractToken::setUser()

void setUser(UserInterface$user)

Sets the authenticated user in the token.

Parameters

UserInterface $user

Return Value

void

Exceptions

InvalidArgumentException

void eraseCredentials()

Removes sensitive information from the token.

Return Value

void

array getAttributes()

Return Value

array

void setAttributes(array$attributes)

Parameters

array $attributes The token attributes

Return Value

void

bool hasAttribute(string$name)

Parameters

string $name

Return Value

bool

mixed getAttribute(string$name)

Parameters

string $name

Return Value

mixed

Exceptions

InvalidArgumentException When attribute doesn't exist for this token

void setAttribute(string$name,mixed$value)

Parameters

string $name
mixed $value

Return Value

void

array __serialize()

Returns all the necessary state of the object for serialization purposes.

Return Value

array

void __unserialize(array$data)

Restores the object state from an array given by __serialize().

Parameters

array $data

Return Value

void