PHP Class Irazasyed\JwtAuthGuard\JwtAuthGuard

Inheritance: implements Illuminate\Contracts\Auth\Guard, use trait Illuminate\Auth\GuardHelpers
Afficher le fichier Open project: irazasyed/jwt-auth-guard

Protected Properties

Свойство Type Description
$jwt Tymon\JWTAuth\JWT The JWT instance.
$lastAttempted Illuminate\Contracts\Auth\Authenticatable The user we last attempted to retrieve.
$request Illuminate\Http\Request The request instance.

Méthodes publiques

Méthode Description
__call ( string $method, array $parameters ) : mixed Magically call the JWT instance.
__construct ( Tymon\JWTAuth\JWT $jwt, Illuminate\Contracts\Auth\UserProvider $provider, Illuminate\Http\Request $request ) Create a new authentication guard.
attempt ( array $credentials = [], boolean $login = true ) : mixed Attempt to authenticate the user using the given credentials and return the token.
generateTokenById ( mixed $id ) : string | null Generate new token by ID.
getLastAttempted ( ) : Illuminate\Contracts\Auth\Authenticatable Get the last user we attempted to authenticate.
getPayload ( ) : Tymon\JWTAuth\Payload Get the raw Payload instance.
getProvider ( ) : Illuminate\Contracts\Auth\UserProvider Get the user provider used by the guard.
getToken ( ) : false | Token Get the token.
getUser ( ) : Illuminate\Contracts\Auth\Authenticatable | null Return the currently cached user.
invalidate ( boolean $forceForever = false ) : boolean Invalidate current token (add it to the blacklist).
login ( Tymon\JWTAuth\Contracts\JWTSubject $user ) : string Create a token for a user.
logout ( boolean $forceForever = true ) : boolean Logout the user.
once ( array $credentials = [] ) : boolean Log a user into the application without sessions or cookies.
onceUsingId ( mixed $id ) : boolean Log the given user ID into the application without sessions or cookies.
refresh ( ) : string Refresh current expired token.
setProvider ( Illuminate\Contracts\Auth\UserProvider $provider ) Set the user provider used by the guard.
setRequest ( Illuminate\Http\Request $request ) Set the current request instance.
setToken ( Token | string $token ) : JwtGuard Set the token.
user ( ) : Illuminate\Contracts\Auth\Authenticatable | null Get the currently authenticated user.
validate ( array $credentials = [] ) : boolean Validate a user's credentials.

Méthodes protégées

Méthode Description
hasValidCredentials ( mixed $user, array $credentials ) : boolean Determine if the user matches the credentials.
requireToken ( ) : Tymon\JWTAuth\JWT Ensure that a token is available in the request.

Method Details

__call() public méthode

Magically call the JWT instance.
public __call ( string $method, array $parameters ) : mixed
$method string
$parameters array
Résultat mixed

__construct() public méthode

Create a new authentication guard.
public __construct ( Tymon\JWTAuth\JWT $jwt, Illuminate\Contracts\Auth\UserProvider $provider, Illuminate\Http\Request $request )
$jwt Tymon\JWTAuth\JWT
$provider Illuminate\Contracts\Auth\UserProvider
$request Illuminate\Http\Request

attempt() public méthode

Attempt to authenticate the user using the given credentials and return the token.
public attempt ( array $credentials = [], boolean $login = true ) : mixed
$credentials array
$login boolean
Résultat mixed

generateTokenById() public méthode

Generate new token by ID.
public generateTokenById ( mixed $id ) : string | null
$id mixed
Résultat string | null

getLastAttempted() public méthode

Get the last user we attempted to authenticate.
public getLastAttempted ( ) : Illuminate\Contracts\Auth\Authenticatable
Résultat Illuminate\Contracts\Auth\Authenticatable

getPayload() public méthode

Get the raw Payload instance.
public getPayload ( ) : Tymon\JWTAuth\Payload
Résultat Tymon\JWTAuth\Payload

getProvider() public méthode

Get the user provider used by the guard.
public getProvider ( ) : Illuminate\Contracts\Auth\UserProvider
Résultat Illuminate\Contracts\Auth\UserProvider

getToken() public méthode

Get the token.
public getToken ( ) : false | Token
Résultat false | Token

getUser() public méthode

Return the currently cached user.
public getUser ( ) : Illuminate\Contracts\Auth\Authenticatable | null
Résultat Illuminate\Contracts\Auth\Authenticatable | null

hasValidCredentials() protected méthode

Determine if the user matches the credentials.
protected hasValidCredentials ( mixed $user, array $credentials ) : boolean
$user mixed
$credentials array
Résultat boolean

invalidate() public méthode

Invalidate current token (add it to the blacklist).
public invalidate ( boolean $forceForever = false ) : boolean
$forceForever boolean
Résultat boolean

login() public méthode

Create a token for a user.
public login ( Tymon\JWTAuth\Contracts\JWTSubject $user ) : string
$user Tymon\JWTAuth\Contracts\JWTSubject
Résultat string

logout() public méthode

Logout the user.
public logout ( boolean $forceForever = true ) : boolean
$forceForever boolean
Résultat boolean

once() public méthode

Log a user into the application without sessions or cookies.
public once ( array $credentials = [] ) : boolean
$credentials array
Résultat boolean

onceUsingId() public méthode

Log the given user ID into the application without sessions or cookies.
public onceUsingId ( mixed $id ) : boolean
$id mixed
Résultat boolean

refresh() public méthode

Refresh current expired token.
public refresh ( ) : string
Résultat string

requireToken() protected méthode

Ensure that a token is available in the request.
protected requireToken ( ) : Tymon\JWTAuth\JWT
Résultat Tymon\JWTAuth\JWT

setProvider() public méthode

Set the user provider used by the guard.
public setProvider ( Illuminate\Contracts\Auth\UserProvider $provider )
$provider Illuminate\Contracts\Auth\UserProvider

setRequest() public méthode

Set the current request instance.
public setRequest ( Illuminate\Http\Request $request )
$request Illuminate\Http\Request

setToken() public méthode

Set the token.
public setToken ( Token | string $token ) : JwtGuard
$token Token | string
Résultat JwtGuard

user() public méthode

Get the currently authenticated user.
public user ( ) : Illuminate\Contracts\Auth\Authenticatable | null
Résultat Illuminate\Contracts\Auth\Authenticatable | null

validate() public méthode

Validate a user's credentials.
public validate ( array $credentials = [] ) : boolean
$credentials array
Résultat boolean

Property Details

$jwt protected_oe property

The JWT instance.
protected JWT,Tymon\JWTAuth $jwt
Résultat Tymon\JWTAuth\JWT

$lastAttempted protected_oe property

The user we last attempted to retrieve.
protected Authenticatable,Illuminate\Contracts\Auth $lastAttempted
Résultat Illuminate\Contracts\Auth\Authenticatable

$request protected_oe property

The request instance.
protected Request,Illuminate\Http $request
Résultat Illuminate\Http\Request