PHP Class JWTAuth, someline-starter

Inheritance: extends Tymon\JWTAuth\Facades\JWTAuth
Show file Open project: someline/someline-starter Class Usage Examples

Public Methods

Method Description
attempt ( array $credentials = [], array $customClaims = [] ) : false | string Attempt to authenticate the user and return the token.
authenticate ( mixed $token = false ) : mixed Authenticate a user via a token.
fromUser ( mixed $user, array $customClaims = [] ) : string Generate a token using the user identifier as the subject claim.
getIdentifier ( ) : string Get the identifier.
getPayload ( mixed $token = false ) : Tymon\JWTAuth\Payload Get the raw Payload instance.
getToken ( ) : boolean | string Get the token.
invalidate ( mixed $token = false ) : boolean Invalidate a token (add it to the blacklist).
manager ( ) : Tymon\JWTAuth\JWTManager Get the JWTManager instance.
parseToken ( $method = 'bearer', $header = 'authorization', string $query = 'token' ) : JWTAuth Parse the token from the request.
refresh ( mixed $token = false ) : string Refresh an expired token.
setIdentifier ( string $identifier ) Set the identifier.
setRequest ( Request $request ) Set the request instance.
setToken ( string $token ) Set the token.
toUser ( boolean | string $token = false ) : mixed Find a user using the user identifier in the subject claim.

Method Details

attempt() public static method

Attempt to authenticate the user and return the token.
public static attempt ( array $credentials = [], array $customClaims = [] ) : false | string
$credentials array
$customClaims array
return false | string

authenticate() public static method

Authenticate a user via a token.
public static authenticate ( mixed $token = false ) : mixed
$token mixed
return mixed

fromUser() public static method

Generate a token using the user identifier as the subject claim.
public static fromUser ( mixed $user, array $customClaims = [] ) : string
$user mixed
$customClaims array
return string

getIdentifier() public static method

Get the identifier.
public static getIdentifier ( ) : string
return string

getPayload() public static method

Get the raw Payload instance.
public static getPayload ( mixed $token = false ) : Tymon\JWTAuth\Payload
$token mixed
return Tymon\JWTAuth\Payload

getToken() public static method

Get the token.
public static getToken ( ) : boolean | string
return boolean | string

invalidate() public static method

Invalidate a token (add it to the blacklist).
public static invalidate ( mixed $token = false ) : boolean
$token mixed
return boolean

manager() public static method

Get the JWTManager instance.
public static manager ( ) : Tymon\JWTAuth\JWTManager
return Tymon\JWTAuth\JWTManager

parseToken() public static method

Parse the token from the request.
public static parseToken ( $method = 'bearer', $header = 'authorization', string $query = 'token' ) : JWTAuth
$query string
return JWTAuth

refresh() public static method

Refresh an expired token.
public static refresh ( mixed $token = false ) : string
$token mixed
return string

setIdentifier() public static method

Set the identifier.
public static setIdentifier ( string $identifier )
$identifier string

setRequest() public static method

Set the request instance.
public static setRequest ( Request $request )
$request Request

setToken() public static method

Set the token.
public static setToken ( string $token )
$token string

toUser() public static method

Find a user using the user identifier in the subject claim.
public static toUser ( boolean | string $token = false ) : mixed
$token boolean | string
return mixed