class SessionGuard implements StatefulGuard, SupportsBasicAuth (View source)

Traits

These methods are typically the same across all guards.

Methods

bool
check()

Determine if the current user is authenticated.

bool
guest()

Determine if the current user is a guest.

int|null
id()

Get the ID for the currently authenticated user.

void
setUser( Authenticatable $user)

Set the current user.

void
__construct( string $name, UserProvider $provider, SessionInterface $session, Request $request = null)

Create a new authentication guard.

user()

Get the currently authenticated user.

bool
once( array $credentials = array())

Log a user into the application without sessions or cookies.

bool
validate( array $credentials = array())

Validate a user's credentials.

Response|null
basic( string $field = 'email', array $extraConditions = array())

Attempt to authenticate using HTTP Basic Auth.

Response|null
onceBasic( string $field = 'email', array $extraConditions = array())

Perform a stateless HTTP Basic login attempt.

bool
attempt( array $credentials = array(), bool $remember = false, bool $login = true)

Attempt to authenticate a user using the given credentials.

void
attempting( mixed $callback)

Register an authentication attempt event listener.

void
login( Authenticatable $user, bool $remember = false)

Log a user into the application.

loginUsingId( mixed $id, bool $remember = false)

Log the given user ID into the application.

bool
onceUsingId( mixed $id)

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

void
logout()

Log the user out of the application.

getCookieJar()

Get the cookie creator instance used by the guard.

void
setCookieJar( QueueingFactory $cookie)

Set the cookie creator instance used by the guard.

getDispatcher()

Get the event dispatcher instance.

void
setDispatcher( Dispatcher $events)

Set the event dispatcher instance.

getSession()

Get the session store used by the guard.

getProvider()

Get the user provider used by the guard.

void
setProvider( UserProvider $provider)

Set the user provider used by the guard.

getUser()

Return the currently cached user.

Request
getRequest()

Get the current request instance.

$this
setRequest( Request $request)

Set the current request instance.

getLastAttempted()

Get the last user we attempted to authenticate.

string
getName()

Get a unique identifier for the auth session value.

string
getRecallerName()

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

bool
viaRemember()

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

Details

bool check()

Determine if the current user is authenticated.

Return Value

bool

bool guest()

Determine if the current user is a guest.

Return Value

bool

at line line 158
int|null id()

Get the ID for the currently authenticated user.

Return Value

int|null

at line line 690
void setUser( Authenticatable $user)

Set the current user.

Parameters

Authenticatable $user

Return Value

void

at line line 95
void __construct( string $name, UserProvider $provider, SessionInterface $session, Request $request = null)

Create a new authentication guard.

Parameters

string $name
UserProvider $provider
SessionInterface $session
Request $request

Return Value

void

at line line 111
Authenticatable|null user()

Get the currently authenticated user.

Return Value

Authenticatable|null

at line line 237
bool once( array $credentials = array())

Log a user into the application without sessions or cookies.

Parameters

array $credentials

Return Value

bool

at line line 254
bool validate( array $credentials = array())

Validate a user's credentials.

Parameters

array $credentials

Return Value

bool

at line line 266
Response|null basic( string $field = 'email', array $extraConditions = array())

Attempt to authenticate using HTTP Basic Auth.

Parameters

string $field
array $extraConditions

Return Value

Response|null

at line line 289
Response|null onceBasic( string $field = 'email', array $extraConditions = array())

Perform a stateless HTTP Basic login attempt.

Parameters

string $field
array $extraConditions

Return Value

Response|null

at line line 349
bool attempt( array $credentials = array(), bool $remember = false, bool $login = true)

Attempt to authenticate a user using the given credentials.

Parameters

array $credentials
bool $remember
bool $login

Return Value

bool

at line line 404
void attempting( mixed $callback)

Register an authentication attempt event listener.

Parameters

mixed $callback

Return Value

void

at line line 418
void login( Authenticatable $user, bool $remember = false)

Log a user into the application.

Parameters

Authenticatable $user
bool $remember

Return Value

void

at line line 473
Authenticatable loginUsingId( mixed $id, bool $remember = false)

Log the given user ID into the application.

Parameters

mixed $id
bool $remember

Return Value

Authenticatable

at line line 488
bool onceUsingId( mixed $id)

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

Parameters

mixed $id

Return Value

bool

at line line 528
void logout()

Log the user out of the application.

Return Value

void

at line line 602
QueueingFactory getCookieJar()

Get the cookie creator instance used by the guard.

Return Value

QueueingFactory

Exceptions

RuntimeException

at line line 617
void setCookieJar( QueueingFactory $cookie)

Set the cookie creator instance used by the guard.

Parameters

QueueingFactory $cookie

Return Value

void

at line line 627
Dispatcher getDispatcher()

Get the event dispatcher instance.

Return Value

Dispatcher

at line line 638
void setDispatcher( Dispatcher $events)

Set the event dispatcher instance.

Parameters

Dispatcher $events

Return Value

void

at line line 648
Store getSession()

Get the session store used by the guard.

Return Value

Store

at line line 658
UserProvider getProvider()

Get the user provider used by the guard.

Return Value

UserProvider

at line line 669
void setProvider( UserProvider $provider)

Set the user provider used by the guard.

Parameters

UserProvider $provider

Return Value

void

at line line 679
Authenticatable|null getUser()

Return the currently cached user.

Return Value

Authenticatable|null

at line line 702
Request getRequest()

Get the current request instance.

Return Value

Request

at line line 713
$this setRequest( Request $request)

Set the current request instance.

Parameters

Request $request

Return Value

$this

at line line 725
Authenticatable getLastAttempted()

Get the last user we attempted to authenticate.

Return Value

Authenticatable

at line line 735
string getName()

Get a unique identifier for the auth session value.

Return Value

string

at line line 745
string getRecallerName()

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

Return Value

string

at line line 755
bool viaRemember()

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

Return Value

bool