TokenGuard
class TokenGuard implements Guard (View source)
Traits
GuardHelpers | These methods are typically the same across all guards. |
Properties
protected Authenticatable | $user | The currently authenticated user. | from GuardHelpers |
protected UserProvider | $provider | The user provider implementation. | from GuardHelpers |
protected Request | $request | The request instance. | |
protected string | $inputKey | The name of the query string item from the request containing the API token. | |
protected string | $storageKey | The name of the token "column" in persistent storage. |
Methods
Authenticatable | authenticate() Determine if current user is authenticated. If not, throw an exception. | from GuardHelpers |
bool | hasUser() Determine if the guard has a user instance. | from GuardHelpers |
bool | check() Determine if the current user is authenticated. | from GuardHelpers |
bool | guest() Determine if the current user is a guest. | from GuardHelpers |
int|null | id() Get the ID for the currently authenticated user. | from GuardHelpers |
$this | setUser(Authenticatable $user) Set the current user. | from GuardHelpers |
UserProvider | getProvider() Get the user provider used by the guard. | from GuardHelpers |
void | setProvider(UserProvider $provider) Set the user provider used by the guard. | from GuardHelpers |
void | __construct(UserProvider $provider, Request $request, string $inputKey = 'api_token', string $storageKey = 'api_token') Create a new authentication guard. | |
Authenticatable|null | user() Get the currently authenticated user. | |
string | getTokenForRequest() Get the token for the current request. | |
bool | validate(array $credentials = []) Validate a user's credentials. | |
$this | setRequest(Request $request) Set the current request instance. |
Details
Authenticatable authenticate()
Determine if current user is authenticated. If not, throw an exception.
bool hasUser()
Determine if the guard has a user instance.
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.
$this setUser(Authenticatable $user)
Set the current user.
UserProvider getProvider()
Get the user provider used by the guard.
void setProvider(UserProvider $provider)
Set the user provider used by the guard.
void __construct(UserProvider $provider, Request $request, string $inputKey = 'api_token', string $storageKey = 'api_token')
Create a new authentication guard.
Authenticatable|null user()
Get the currently authenticated user.
string getTokenForRequest()
Get the token for the current request.
bool validate(array $credentials = [])
Validate a user's credentials.
$this setRequest(Request $request)
Set the current request instance.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.7/Illuminate/Auth/TokenGuard.html