SessionGuard
Implements
Uses
Properties
$name string
The name of the guard. Typically "web".
Corresponds to guard name in authentication configuration.
$viaRemember bool
Indicates if the user was authenticated via a recaller cookie.
$rememberDuration int
The number of minutes that the "remember me" cookie should be valid for.
$request Symfony\...\Request
The request instance.
$loggedOut bool
Indicates if the logout method has been called.
$recallAttempted bool
Indicates if a token user retrieval has been attempted.
Methods
__construct ( $name , UserProvider $provider , Session $session , Symfony\...\Request $request , Timebox $timebox ) : void
Create a new authentication guard.
Parameters
- $name string
- $provider UserProvider
- $session Session
- $request Symfony\...\Request|null
- $timebox Timebox |null
userFromRecaller ( $recaller ) : mixed
Pull a user from the repository by its "remember me" cookie token.
Parameters
- $recaller Recaller
id ( ) : int|string|null
Get the ID for the currently authenticated user.
once ( array $credentials ) : bool
Log a user into the application without sessions or cookies.
Parameters
- $credentials array
onceUsingId ( $id ) : Authenticatable |false
Log the given user ID into the application without sessions or cookies.
Parameters
- $id mixed
validate ( array $credentials ) : bool
Validate a user's credentials.
Parameters
- $credentials array
basic ( $field , $extraConditions ) : Symfony\...\Response|null
Attempt to authenticate using HTTP Basic Auth.
Parameters
- $field string
- $extraConditions array
onceBasic ( $field , $extraConditions ) : Symfony\...\Response|null
Perform a stateless HTTP Basic login attempt.
Parameters
- $field string
- $extraConditions array
attemptBasic ( Symfony\...\Request $request , $field , $extraConditions ) : bool
Attempt to authenticate using basic authentication.
Parameters
- $request Symfony\...\Request
- $field string
- $extraConditions array
basicCredentials ( Symfony\...\Request $request , $field ) : array
Get the credential array for an HTTP Basic request.
Parameters
- $request Symfony\...\Request
- $field string
failedBasicResponse ( ) : void
Get the response for basic authentication.
attempt ( array $credentials , $remember ) : bool
Attempt to authenticate a user using the given credentials.
Parameters
- $credentials array
- $remember bool
attemptWhen ( array $credentials , $callbacks , $remember ) : bool
Attempt to authenticate a user with credentials and additional callbacks.
Parameters
- $credentials array
- $callbacks array|callable|null
- $remember bool
hasValidCredentials ( $user , $credentials ) : bool
Determine if the user matches the credentials.
Parameters
- $user mixed
- $credentials array
shouldLogin ( $callbacks , Authenticatable $user ) : bool
Determine if the user should login by executing the given callbacks.
Parameters
- $callbacks array|callable|null
- $user Authenticatable
loginUsingId ( $id , $remember ) : Authenticatable |false
Log the given user ID into the application.
Parameters
- $id mixed
- $remember bool
login ( Authenticatable $user , $remember ) : void
Log a user into the application.
Parameters
- $user Authenticatable
- $remember bool
updateSession ( $id ) : void
Update the session with the given ID.
Parameters
- $id string
ensureRememberTokenIsSet ( Authenticatable $user ) : void
Create a new "remember me" token for the user if one doesn't already exist.
Parameters
- $user Authenticatable
queueRecallerCookie ( Authenticatable $user ) : void
Queue the recaller cookie into the cookie jar.
Parameters
- $user Authenticatable
createRecaller ( $value ) : Symfony\...\Cookie
Create a "remember me" cookie for a given ID.
Parameters
- $value string
logout ( ) : void
Log the user out of the application.
logoutCurrentDevice ( ) : void
Log the user out of the application on their current device only.
clearUserDataFromStorage ( ) : void
Remove the user data from the session and cookies.
cycleRememberToken ( Authenticatable $user ) : void
Refresh the "remember me" token for the user.
Parameters
- $user Authenticatable
logoutOtherDevices ( $password , $attribute ) : Authenticatable |null
Invalidate other sessions for the current user.
Parameters
- $password string
- $attribute string
rehashUserPassword ( $password , $attribute ) : Authenticatable |null
Rehash the current user's password.
Parameters
- $password string
- $attribute string
attempting ( $callback ) : void
Register an authentication attempt event listener.
Parameters
- $callback mixed
fireAttemptEvent ( array $credentials , $remember ) : void
Fire the attempt event with the arguments.
Parameters
- $credentials array
- $remember bool
fireValidatedEvent ( $user ) : void
Fires the validated event if the dispatcher is set.
Parameters
- $user Authenticatable
fireLoginEvent ( $user , $remember ) : void
Fire the login event if the dispatcher is set.
Parameters
- $user Authenticatable
- $remember bool
fireAuthenticatedEvent ( $user ) : void
Fire the authenticated event if the dispatcher is set.
Parameters
- $user Authenticatable
fireOtherDeviceLogoutEvent ( $user ) : void
Fire the other device logout event if the dispatcher is set.
Parameters
- $user Authenticatable
fireFailedEvent ( $user , array $credentials ) : void
Fire the failed authentication attempt event with the given arguments.
Parameters
- $user Authenticatable |null
- $credentials array
getName ( ) : string
Get a unique identifier for the auth session value.
getRecallerName ( ) : string
Get the name of the cookie used to store the "recaller".
viaRemember ( ) : bool
Determine if the user was authenticated via "remember me" cookie.
getRememberDuration ( ) : int
Get the number of minutes the remember me cookie should be valid for.
setRememberDuration ( $minutes ) : $this
Set the number of minutes the remember me cookie should be valid for.
Parameters
- $minutes int
setCookieJar ( QueueingFactory $cookie ) : void
Set the cookie creator instance used by the guard.
Parameters
- $cookie QueueingFactory
setDispatcher ( Dispatcher $events ) : void
Set the event dispatcher instance.
Parameters
- $events Dispatcher
setUser ( Authenticatable $user ) : $this
Set the current user.
Parameters
- $user Authenticatable
getRequest ( ) : Symfony\...\Request
Get the current request instance.
setRequest ( Symfony\...\Request $request ) : $this
Set the current request instance.
Parameters
- $request Symfony\...\Request