TokenGuard
in package
implements
Guard
Uses
GuardHelpers
Interfaces, Classes and Traits
Table of Contents
- $inputKey : string
- The name of the query string item from the request containing the API token.
- $provider : UserProvider
- The user provider implementation.
- $request : Request
- The request instance.
- $storageKey : string
- The name of the token "column" in persistent storage.
- $user : Authenticatable
- The currently authenticated user.
- __construct() : void
- Create a new authentication guard.
- authenticate() : Authenticatable
- Determine if the current user is authenticated.
- check() : bool
- Determine if the current user is authenticated.
- getProvider() : UserProvider
- Get the user provider used by the guard.
- getTokenForRequest() : string
- Get the token for the current request.
- guest() : bool
- Determine if the current user is a guest.
- id() : int|null
- Get the ID for the currently authenticated user.
- setProvider() : void
- Set the user provider used by the guard.
- setRequest() : $this
- Set the current request instance.
- setUser() : $this
- Set the current user.
- user() : Authenticatable|null
- Get the currently authenticated user.
- validate() : bool
- Validate a user's credentials.
Properties
$inputKey
The name of the query string item from the request containing the API token.
protected
string
$inputKey
$provider
The user provider implementation.
protected
UserProvider
$provider
$request
The request instance.
protected
Request
$request
$storageKey
The name of the token "column" in persistent storage.
protected
string
$storageKey
$user
The currently authenticated user.
protected
Authenticatable
$user
Methods
__construct()
Create a new authentication guard.
public
__construct(UserProvider $provider, Request $request) : void
Parameters
- $provider : UserProvider
- $request : Request
Return values
void —authenticate()
Determine if the current user is authenticated.
public
authenticate() : Authenticatable
Tags
Return values
Authenticatable —check()
Determine if the current user is authenticated.
public
check() : bool
Return values
bool —getProvider()
Get the user provider used by the guard.
public
getProvider() : UserProvider
Return values
UserProvider —getTokenForRequest()
Get the token for the current request.
public
getTokenForRequest() : string
Return values
string —guest()
Determine if the current user is a guest.
public
guest() : bool
Return values
bool —id()
Get the ID for the currently authenticated user.
public
id() : int|null
Return values
int|null —setProvider()
Set the user provider used by the guard.
public
setProvider(UserProvider $provider) : void
Parameters
- $provider : UserProvider
Return values
void —setRequest()
Set the current request instance.
public
setRequest(Request $request) : $this
Parameters
- $request : Request
Return values
$this —setUser()
Set the current user.
public
setUser(Authenticatable $user) : $this
Parameters
- $user : Authenticatable
Return values
$this —user()
Get the currently authenticated user.
public
user() : Authenticatable|null
Return values
Authenticatable|null —validate()
Validate a user's credentials.
public
validate([array<string|int, mixed> $credentials = [] ]) : bool
Parameters
- $credentials : array<string|int, mixed> = []