$userType
$userType : string
The user object type.
The Authenticator service helps with user authentication / login.
Constructor dependencies are passed as an array of key=>value
pair.
The required dependencies are:
logger
A PSR3 logger instanceuser_type
The user object type (FQN or ident)user_factory
The Factory used to instanciate new users.token_type
The auth token object type (FQN or ident)token_factory
The Factory used to instanciate new auth tokens.authenticate() : \Charcoal\User\UserInterface|null
Determine if the current user is authenticated.
The user is authenticated via session ID or auth token.
Returns the authenticated user object or NULL if not authenticated.
authenticateByPassword(string $username, string $password) : \Charcoal\User\UserInterface|null
Attempt to authenticate a user using the given credentials.
string | $username | Username, part of necessery credentials. |
string | $password | Password, part of necessary credentials. |
If username or password are invalid or empty.
Returns the authenticated user object or NULL if not authenticated.
setTokenType(string $type) : \Charcoal\User\AdminAuthenticator
Set the authorization token type (model).
string | $type | The auth-token object type. |
If the token object type parameter is not a string.
Chainable
setTokenFactory(\Charcoal\Factory\FactoryInterface $factory) : \Charcoal\User\AdminAuthenticator
Set a model factory for token-based authentication.
\Charcoal\Factory\FactoryInterface | $factory | The factory used to create new auth-token instances. |
Chainable
authenticateBySession() : \Charcoal\User\UserInterface|null
Attempt to authenticate a user using their session ID.
Returns the authenticated user object or NULL if not authenticated.
authenticateByToken() : \Charcoal\User\UserInterface|null
Attempt to authenticate a user using their auth token.
Returns the authenticated user object or NULL if not authenticated.