October\Rain\Auth\Manager

Source: ~/vendor/october/rain/src/Auth/Manager.php

Implements:

  • Illuminate\Contracts\Auth\StatefulGuard
  • Illuminate\Contracts\Auth\Guard

Authentication manager

Public properties

public string $ipAddress

The IP address of this request

Protected properties

protected Models\User $user

The currently logged in user

protected array $throttle

In memory throttle cache [md5($userId.$ipAddress) => $this->throttleModel]

protected string $userModel

User Model Class

protected string $groupModel

User Group Model Class

protected string $throttleModel

Throttle Model Class

protected bool $useThrottle

Flag to enable login throttling

protected bool $useSession

Internal flag to toggle using the session for the current authentication request

protected bool $requireActivation

Flag to require users to be activated to login

protected string $sessionKey

Key to store the auth session data in

protected bool $viaRemember

Indicates if the user was authenticated via a recaller cookie.

protected static $instance

Public methods

public void __clone()

public void __wakeup()

public Models\User attempt(array $credentials=array(), bool $remember=false)

Attempt to authenticate a user using the given credentials.

Parameters
  • array $credentials - The user login details
  • bool $remember - Store a non-expire cookie for the user

public void authenticate(array $credentials, bool $remember=true)

Attempts to authenticate the given user according to the passed credentials.

Parameters
  • array $credentials - The user login details
  • bool $remember - Store a non-expire cookie for the user

public bool check()

Check to see if the user is logged in and activated, and hasn't been banned or suspended.

public Models\Throttle createThrottleModel()

Creates an instance of the throttle model

public Models\User createUserModel()

Creates a new instance of the user model

public void extendUserQuery(October\Rain\Database\Builder $query)

Extend the query used for finding the user.

Parameters

public Models\Throttle findThrottleByLogin(string $loginName, string $ipAddress)

Find a throttle record by login and ip address

Parameters
  • string $loginName
  • string $ipAddress

public Models\Throttle findThrottleByUserId(integer $userId, string $ipAddress=NULL)

Find a throttle record by user id and ip address

Parameters
  • integer $userId
  • string $ipAddress

public Models\User findUserByCredentials(array $credentials)

Finds a user by the given credentials.

Parameters
  • array $credentials - The credentials to find a user by

public mixed findUserById(string $id)

Finds a user by the login value.

Parameters
  • string $id

public mixed findUserByLogin(string $login)

Finds a user by the login value.

Parameters
  • string $login

public static void forgetInstance()

Forget this singleton's instance if it exists

public mixed getImpersonator()

Get the original user doing the impersonation

public mixed getUser()

Returns the current user, if any.

public bool guest()

Determine if the current user is a guest.

public int|null id()

Get the ID for the currently authenticated user.

public void impersonate($user)

Impersonates the given user and sets properties in the session but not the cookie.

Parameters
  • $user

public static void instance()

Create a new instance of this singleton.

public bool isImpersonator()

Check to see if the current session is being impersonated

public void login($user, $remember=true)

Logs in the given user and sets properties in the session.

Parameters
  • $user
  • $remember

public Illuminate\Contracts\Auth\Authenticatable loginUsingId(mixed $id, bool $remember=false)

Log the given user ID into the application.

Parameters
  • mixed $id
  • bool $remember

public void logout()

Logs the current user out.

public bool once(array $credentials=array())

Log a user into the application without sessions or cookies.

Parameters
  • array $credentials

public Illuminate\Contracts\Auth\Authenticatable|false onceUsingId(mixed $id)

Log the given user ID into the application without sessions or cookies.

Parameters
  • mixed $id

public Models\User register(array $credentials, bool $activate=false, bool $autoLogin=true)

Registers a user with the provided credentials with optional flags for activating the newly created user and automatically logging them in

Parameters
  • array $credentials
  • bool $activate
  • bool $autoLogin

public void setUser($user)

Sets the user

Parameters
  • $user

public void stopImpersonate()

Stop the current session being impersonated and authenticate as the impersonator again

public Illuminate\Contracts\Auth\Authenticatable|null user()

Get the currently authenticated user.

public bool validate(array $credentials=array())

Validate a user's credentials.

Parameters
  • array $credentials

public bool viaRemember()

Determine if the user was authenticated via "remember me" cookie.

Protected methods

protected void __construct()

Constructor.

protected October\Rain\Database\Builder createUserModelQuery()

Prepares a query derived from the user model.

protected void init()

Initializes the singleton

protected User validateInternal(array $credentials=array())

Validate a user's credentials, method used internally.

Parameters
  • array $credentials

protected boolean validateUserModel($user $user)

Perform additional checks on the user model.

Parameters
  • $user $user