JwtAuthGuard
class JwtAuthGuard implements Guard
Jwt Guard
Traits
Properties
protected Authenticatable | $lastAttempted | The user we last attempted to retrieve. |
|
protected JWT | $jwt | The JWT instance. |
|
protected Request | $request | The request instance. |
Methods
Create a new authentication guard.
Get the currently authenticated user.
Log a user into the application without sessions or cookies.
Validate a user's credentials.
Attempt to authenticate the user using the given credentials and return the token.
Create a token for a user.
Log the given user ID into the application without sessions or cookies.
Logout the user.
Generate new token by ID.
Refresh current expired token.
Invalidate current token (add it to the blacklist).
Get the token.
Set the token.
Get the raw Payload instance.
Determine if the user matches the credentials.
Ensure that a token is available in the request.
Get the last user we attempted to authenticate.
Return the currently cached user.
Get the user provider used by the guard.
Set the user provider used by the guard.
Set the current request instance.
Magically call the JWT instance.
Details
at line 48
__construct(JWT $jwt, UserProvider $provider, Request $request)
Create a new authentication guard.
at line 59
Authenticatable|null
user()
Get the currently authenticated user.
at line 76
bool
once(array $credentials = [])
Log a user into the application without sessions or cookies.
at line 92
bool
validate(array $credentials = [])
Validate a user's credentials.
at line 103
mixed
attempt(array $credentials = [], bool $login = true)
Attempt to authenticate the user using the given credentials and return the token.
at line 118
string
login(JWTSubject $user)
Create a token for a user.
at line 130
bool
onceUsingId(mixed $id)
Log the given user ID into the application without sessions or cookies.
at line 146
void
logout(bool $forceForever = true)
Logout the user.
at line 158
string|null
generateTokenById(mixed $id)
Generate new token by ID.
at line 169
string
refresh()
Refresh current expired token.
at line 179
JWT
invalidate(bool $forceForever = false)
Invalidate current token (add it to the blacklist).
at line 188
false|Token
getToken()
Get the token.
at line 198
JwtAuthGuard
setToken(Token|string $token)
Set the token.
at line 209
Payload
getPayload()
Get the raw Payload instance.
at line 220
protected bool
hasValidCredentials(mixed $user, array $credentials)
Determine if the user matches the credentials.
at line 230
protected JWT
requireToken()
Ensure that a token is available in the request.
at line 243
Authenticatable
getLastAttempted()
Get the last user we attempted to authenticate.
at line 252
Authenticatable|null
getUser()
Return the currently cached user.
at line 261
UserProvider
getProvider()
Get the user provider used by the guard.
at line 271
$this
setProvider(UserProvider $provider)
Set the user provider used by the guard.
at line 283
$this
setRequest(Request $request)
Set the current request instance.
at line 297
mixed
__call(string $method, array $parameters)
Magically call the JWT instance.