class Illuminate / Auth / SessionGuard
You are viewing an older version of the documentation. For the latest, please visit master documentation.

SessionGuard

Implements

Uses

Properties

protected

$name string

The name of the guard. Typically "web".

Corresponds to guard name in authentication configuration.

Default: null
protected

$lastAttempted Authenticatable

The user we last attempted to retrieve.

Default: null
protected

$viaRemember bool

Indicates if the user was authenticated via a recaller cookie.

Default: false
protected

$rememberDuration int

The number of minutes that the "remember me" cookie should be valid for.

Default: 2628000
protected

$session Session

The session used by the guard.

Default: null
protected

The Illuminate cookie creator service.

Default: null
protected

$request Symfony\...\Request

The request instance.

Default: null
protected

$events Dispatcher

The event dispatcher instance.

Default: null
protected

$timebox Timebox

The timebox instance.

Default: null
protected

$loggedOut bool

Indicates if the logout method has been called.

Default: false
protected

$recallAttempted bool

Indicates if a token user retrieval has been attempted.

Default: false

Methods

public

__construct ( $name , UserProvider $provider , Session $session , Symfony\...\Request $request , Timebox $timebox ) : void

Create a new authentication guard.

Parameters

public

user ( ) : Authenticatable |null

Get the currently authenticated user.

protected

userFromRecaller ( $recaller ) : mixed

Pull a user from the repository by its "remember me" cookie token.

Parameters

protected

recaller ( ) : Recaller |null

Get the decrypted recaller cookie for the request.

public

id ( ) : int|string|null

Get the ID for the currently authenticated user.

public

once ( array $credentials ) : bool

Log a user into the application without sessions or cookies.

Parameters

  • $credentials array
public

onceUsingId ( $id ) : Authenticatable |false

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

Parameters

  • $id mixed
public

validate ( array $credentials ) : bool

Validate a user's credentials.

Parameters

  • $credentials array
public

basic ( $field , $extraConditions ) : Symfony\...\Response|null

Attempt to authenticate using HTTP Basic Auth.

Parameters

  • $field string
  • $extraConditions array
public

onceBasic ( $field , $extraConditions ) : Symfony\...\Response|null

Perform a stateless HTTP Basic login attempt.

Parameters

  • $field string
  • $extraConditions array
protected

attemptBasic ( Symfony\...\Request $request , $field , $extraConditions ) : bool

Attempt to authenticate using basic authentication.

Parameters

  • $request Symfony\...\Request
  • $field string
  • $extraConditions array
protected

basicCredentials ( Symfony\...\Request $request , $field ) : array

Get the credential array for an HTTP Basic request.

Parameters

  • $request Symfony\...\Request
  • $field string
protected

failedBasicResponse ( ) : void

Get the response for basic authentication.

public

attempt ( array $credentials , $remember ) : bool

Attempt to authenticate a user using the given credentials.

Parameters

  • $credentials array
  • $remember bool
public

attemptWhen ( array $credentials , $callbacks , $remember ) : bool

Attempt to authenticate a user with credentials and additional callbacks.

Parameters

  • $credentials array
  • $callbacks array|callable
  • $remember false
protected

hasValidCredentials ( $user , $credentials ) : bool

Determine if the user matches the credentials.

Parameters

  • $user mixed
  • $credentials array
protected

shouldLogin ( $callbacks , Authenticatable $user ) : bool

Determine if the user should login by executing the given callbacks.

Parameters

public

loginUsingId ( $id , $remember ) : Authenticatable |false

Log the given user ID into the application.

Parameters

  • $id mixed
  • $remember bool
public

login ( Authenticatable $user , $remember ) : void

Log a user into the application.

Parameters

protected

updateSession ( $id ) : void

Update the session with the given ID.

Parameters

  • $id string
protected

ensureRememberTokenIsSet ( Authenticatable $user ) : void

Create a new "remember me" token for the user if one doesn't already exist.

Parameters

protected

queueRecallerCookie ( Authenticatable $user ) : void

Queue the recaller cookie into the cookie jar.

Parameters

protected

createRecaller ( $value ) : Symfony\...\Cookie

Create a "remember me" cookie for a given ID.

Parameters

  • $value string
public

logout ( ) : void

Log the user out of the application.

public

logoutCurrentDevice ( ) : void

Log the user out of the application on their current device only.

protected

clearUserDataFromStorage ( ) : void

Remove the user data from the session and cookies.

protected

cycleRememberToken ( Authenticatable $user ) : void

Refresh the "remember me" token for the user.

Parameters

public

logoutOtherDevices ( $password , $attribute ) : Authenticatable |null

Invalidate other sessions for the current user.

Parameters

  • $password string
  • $attribute string
protected

rehashUserPassword ( $password , $attribute ) : Authenticatable |null

Rehash the current user's password.

Parameters

  • $password string
  • $attribute string
public

attempting ( $callback ) : void

Register an authentication attempt event listener.

Parameters

  • $callback mixed
protected

fireAttemptEvent ( array $credentials , $remember ) : void

Fire the attempt event with the arguments.

Parameters

  • $credentials array
  • $remember bool
protected

fireValidatedEvent ( $user ) : void

Fires the validated event if the dispatcher is set.

Parameters

protected

fireLoginEvent ( $user , $remember ) : void

Fire the login event if the dispatcher is set.

Parameters

protected

fireAuthenticatedEvent ( $user ) : void

Fire the authenticated event if the dispatcher is set.

Parameters

protected

fireOtherDeviceLogoutEvent ( $user ) : void

Fire the other device logout event if the dispatcher is set.

Parameters

protected

fireFailedEvent ( $user , array $credentials ) : void

Fire the failed authentication attempt event with the given arguments.

Parameters

public

getLastAttempted ( ) : Authenticatable

Get the last user we attempted to authenticate.

public

getName ( ) : string

Get a unique identifier for the auth session value.

public

getRecallerName ( ) : string

Get the name of the cookie used to store the "recaller".

public

viaRemember ( ) : bool

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

protected

getRememberDuration ( ) : int

Get the number of minutes the remember me cookie should be valid for.

public

setRememberDuration ( $minutes ) : $this

Set the number of minutes the remember me cookie should be valid for.

Parameters

  • $minutes int
public

getCookieJar ( ) : QueueingFactory

Get the cookie creator instance used by the guard.

public

setCookieJar ( QueueingFactory $cookie ) : void

Set the cookie creator instance used by the guard.

Parameters

public

getDispatcher ( ) : Dispatcher

Get the event dispatcher instance.

public

setDispatcher ( Dispatcher $events ) : void

Set the event dispatcher instance.

Parameters

public

getSession ( ) : Session

Get the session store used by the guard.

public

getUser ( ) : Authenticatable |null

Return the currently cached user.

public

setUser ( Authenticatable $user ) : $this

Set the current user.

Parameters

public

getRequest ( ) : Symfony\...\Request

Get the current request instance.

public

setRequest ( Symfony\...\Request $request ) : $this

Set the current request instance.

Parameters

  • $request Symfony\...\Request
public

getTimebox ( ) : Timebox

Get the timebox instance used by the guard.