UserBadge
in package
implements
BadgeInterface
Represents the user in the authentication process.
It uses an identifier (e.g. email, or username) and "user loader" to load the related User object.
Tags
Table of Contents
Interfaces
- BadgeInterface
- Passport badges allow to add more information to a passport (e.g. a CSRF token).
Properties
- $user : mixed
- $userIdentifier : string
- $userLoader : callable|null
Methods
- __construct() : mixed
- Initializes the user badge.
- getUser() : UserInterface
- getUserIdentifier() : string
- getUserLoader() : callable|null
- isResolved() : bool
- Checks if this badge is resolved by the security system.
- setUserLoader() : void
Properties
$user
private
mixed
$user
$userIdentifier
private
string
$userIdentifier
$userLoader
private
callable|null
$userLoader
Methods
__construct()
Initializes the user badge.
public
__construct(string $userIdentifier[, callable $userLoader = null ]) : mixed
You must provide a $userIdentifier. This is a unique string representing the user for this authentication (e.g. the email if authentication is done using email + password; or a string combining email+company if authentication is done based on email and company name). This string can be used for e.g. login throttling.
Optionally, you may pass a user loader. This callable receives the $userIdentifier as argument and must return a UserInterface object (otherwise an AuthenticationServiceException is thrown). If this is not set, the default user provider will be used with $userIdentifier as username.
Parameters
- $userIdentifier : string
- $userLoader : callable = null
getUser()
public
getUser() : UserInterface
Tags
Return values
UserInterfacegetUserIdentifier()
public
getUserIdentifier() : string
Return values
stringgetUserLoader()
public
getUserLoader() : callable|null
Return values
callable|nullisResolved()
Checks if this badge is resolved by the security system.
public
isResolved() : bool
After authentication, all badges must return true
in this method in order
for the authentication to succeed.
Return values
boolsetUserLoader()
public
setUserLoader(callable $userLoader) : void
Parameters
- $userLoader : callable