Authentication

This section will introduce you to the authentication service and how to user it.

User Authenticator

This class will go over the \Anomaly\UsersModule\User\UserAuthenticator class and how to use it.

UserAuthenticator::attempt()

The attempt method attempts to authorize a user. The login method is ran if the authentication succeeds.

Returns: \Anomaly\UsersModule\User\Contract\UserInterface or false
Arguments
Key Required Type Default Description
$credentials true array none The credentials array of email/username and password.
$remember false boolean false The "remember me" flag.
Example
$authenticator->attempt(['email' => '[email protected]', 'password' => 'secret']);
UserAuthenticator::authenticate()

The authenticate method authenticates credentials without logging the user in.

Returns: \Anomaly\UsersModule\User\Contract\UserInterface or false
Arguments
Key Required Type Default Description
$credentials true array none The credentials array of email/username and password.
Example
$authenticator->authenticate(['email' => '[email protected]', 'password' => 'secret password']);
UserAuthenticator::login()

The login method logs in the user.

Returns: void
Arguments
Key Required Type Default Description
$user true object none The user instance.
Example
$authenticator->login($user);
UserAuthenticator::logout()

The logout method logs out the user.

Returns: void
Arguments
Key Required Type Default Description
$user true object none The user to logout.
Example
$authenticator->logout($user);
UserAuthenticator::kickOut()

The kickOut method kicks a user. The kickOut method is similar to logout but a different event is fired for you to hook into as needed.

Returns: void
Arguments
Key Required Type Default Description
$user true object none The user to kick out.
Example
$authenticator->kickOut($user);