Guard
class Guard (View source)
Properties
protected UserInterface | $user | The currently authenticated user. |
|
protected UserInterface | $lastAttempted | The user we last attempted to retrieve. |
|
protected bool | $viaRemember | Indicates if the user was authenticated via a recaller cookie. |
|
protected UserProviderInterface | $provider | The user provider implementation. |
|
protected Store | $session | The session store used by the guard. |
|
protected CookieJar | $cookie | The Illuminate cookie creator service. |
|
protected Request | $request | The request instance. |
|
protected Dispatcher | $events | The event dispatcher instance. |
|
protected bool | $loggedOut | Indicates if the logout method has been called. |
|
protected bool | $tokenRetrievalAttempted | Indicates if a token user retrieval has been attempted. |
Methods
Create a new authentication guard.
Determine if the current user is authenticated.
Determine if the current user is a guest.
Get the currently authenticated user.
Get the ID for the currently authenticated user.
Pull a user from the repository by its recaller ID.
Get the decrypted recaller cookie for the request.
Get the user ID from the recaller cookie.
Determine if the recaller cookie is in a valid format.
Log a user into the application without sessions or cookies.
Validate a user's credentials.
Attempt to authenticate using HTTP Basic Auth.
Perform a stateless HTTP Basic login attempt.
Attempt to authenticate using basic authentication.
Get the credential array for a HTTP Basic request.
Get the response for basic authentication.
Attempt to authenticate a user using the given credentials.
Determine if the user matches the credentials.
Fire the attempt event with the arguments.
Register an authentication attempt event listener.
Update the session with the given ID.
Log the given user ID into the application.
Log the given user ID into the application without sessions or cookies.
Create a remember me cookie for a given ID.
Log the user out of the application.
Remove the user data from the session and cookies.
Create a new remember token for the user if one doesn't already exist.
Get the cookie creator instance used by the guard.
Get the event dispatcher instance.
Get the session store used by the guard.
Get the user provider used by the guard.
Return the currently cached user of the application.
Get the current request instance.
Set the current request instance.
Get the last user we attempted to authenticate.
Get a unique identifier for the auth session value.
Get the name of the cookie used to store the "recaller".
Determine if the user was authenticated via "remember me" cookie.
Details
void
__construct(UserProviderInterface $provider, Store $session, Request $request = null)
Create a new authentication guard.
bool
check()
Determine if the current user is authenticated.
bool
guest()
Determine if the current user is a guest.
UserInterface|null
user()
Get the currently authenticated user.
int|null
id()
Get the ID for the currently authenticated user.
protected mixed
getUserByRecaller(string $recaller)
Pull a user from the repository by its recaller ID.
protected string|null
getRecaller()
Get the decrypted recaller cookie for the request.
protected string
getRecallerId()
Get the user ID from the recaller cookie.
protected bool
validRecaller(string $recaller)
Determine if the recaller cookie is in a valid format.
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', Request $request = null)
Attempt to authenticate using HTTP Basic Auth.
Response|null
onceBasic(string $field = 'email', Request $request = null)
Perform a stateless HTTP Basic login attempt.
protected bool
attemptBasic(Request $request, string $field)
Attempt to authenticate using basic authentication.
protected array
getBasicCredentials(Request $request, string $field)
Get the credential array for a HTTP Basic request.
protected Response
getBasicResponse()
Get the response for basic authentication.
bool
attempt(array $credentials = array(), bool $remember = false, bool $login = true)
Attempt to authenticate a user using the given credentials.
protected bool
hasValidCredentials(mixed $user, array $credentials)
Determine if the user matches the credentials.
protected void
fireAttemptEvent(array $credentials, bool $remember, bool $login)
Fire the attempt event with the arguments.
void
attempting(mixed $callback)
Register an authentication attempt event listener.
void
login(UserInterface $user, bool $remember = false)
Log a user into the application.
protected void
updateSession(string $id)
Update the session with the given ID.
UserInterface
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.
protected void
queueRecallerCookie(UserInterface $user)
Queue the recaller cookie into the cookie jar.
protected Cookie
createRecaller(string $value)
Create a remember me cookie for a given ID.
void
logout()
Log the user out of the application.
protected void
clearUserDataFromStorage()
Remove the user data from the session and cookies.
protected void
refreshRememberToken(UserInterface $user)
Refresh the remember token for the user.
protected void
createRememberTokenIfDoesntExist(UserInterface $user)
Create a new remember token for the user if one doesn't already exist.
CookieJar
getCookieJar()
Get the cookie creator instance used by the guard.
void
setCookieJar(CookieJar $cookie)
Set the cookie creator instance used by the guard.
Dispatcher
getDispatcher()
Get the event dispatcher instance.
void
setDispatcher(Dispatcher $events)
Set the event dispatcher instance.
Store
getSession()
Get the session store used by the guard.
UserProviderInterface
getProvider()
Get the user provider used by the guard.
void
setProvider(UserProviderInterface $provider)
Set the user provider used by the guard.
UserInterface|null
getUser()
Return the currently cached user of the application.
void
setUser(UserInterface $user)
Set the current user of the application.
Request
getRequest()
Get the current request instance.
$this
setRequest(Request $request)
Set the current request instance.
UserInterface
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.