PHP 클래스 GenTux\Jwt\JwtToken

상속: implements JsonSerializabl\JsonSerializable
파일 보기 프로젝트 열기: generationtux/jwt-artisan 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( GenTux\Jwt\Drivers\JwtDriverInterface $jwt, string | null $secret = null, string | null $algorithm = null )
__toString ( ) : string Convert into string
algorithm ( ) : string Get the algorithm to use
createToken ( GenTux\Jwt\JwtPayloadInterface | array $payload, string | null $secret = null, string | null $algo = null ) : JwtToken Create a new token with the provided payload
jsonSerialize ( ) : mixed Specify data which should be serialized to JSON
payload ( string | null $path = null, string | null $secret = null, string | null $algo = null ) : array Get the payload from the current token
secret ( ) : string Get the secret to use for token operations
setAlgorithm ( string $algo ) : self Set the algorithm to use
setSecret ( string $secret ) : self Set the secret to use for token operations
setToken ( string $token ) : self Set the current JWT token
token ( ) : string Get the current JWT token
validate ( string | null $secret = null, string | null $algo = null ) : boolean Validate a token
validateOrFail ( string | null $secret = null, string | null $algo = null ) : boolean Validate the token or throw an exception

비공개 메소드들

메소드 설명
queryPayload ( array $payload, string | null $path = null ) : mixed Query the payload using dot syntax to find specific data

메소드 상세

__construct() 공개 메소드

public __construct ( GenTux\Jwt\Drivers\JwtDriverInterface $jwt, string | null $secret = null, string | null $algorithm = null )
$jwt GenTux\Jwt\Drivers\JwtDriverInterface
$secret string | null
$algorithm string | null

__toString() 공개 메소드

Convert into string
public __toString ( ) : string
리턴 string

algorithm() 공개 메소드

This can be customized by setting the env variable JWT_ALGO
public algorithm ( ) : string
리턴 string

createToken() 공개 메소드

The default algorithm used is HS256. To set a custom one, set the env variable JWT_ALGO.
public createToken ( GenTux\Jwt\JwtPayloadInterface | array $payload, string | null $secret = null, string | null $algo = null ) : JwtToken
$payload GenTux\Jwt\JwtPayloadInterface | array
$secret string | null
$algo string | null
리턴 JwtToken

jsonSerialize() 공개 메소드

Specify data which should be serialized to JSON
public jsonSerialize ( ) : mixed
리턴 mixed data which can be serialized by json_encode, which is a value of any type other than a resource.

payload() 공개 메소드

Get the payload from the current token
public payload ( string | null $path = null, string | null $secret = null, string | null $algo = null ) : array
$path string | null dot syntax to query for specific data
$secret string | null
$algo string | null
리턴 array

secret() 공개 메소드

Get the secret to use for token operations
public secret ( ) : string
리턴 string

setAlgorithm() 공개 메소드

Set the algorithm to use
public setAlgorithm ( string $algo ) : self
$algo string
리턴 self

setSecret() 공개 메소드

Set the secret to use for token operations
public setSecret ( string $secret ) : self
$secret string
리턴 self

setToken() 공개 메소드

Set the current JWT token
public setToken ( string $token ) : self
$token string
리턴 self

token() 공개 메소드

Get the current JWT token
public token ( ) : string
리턴 string

validate() 공개 메소드

Validate a token
public validate ( string | null $secret = null, string | null $algo = null ) : boolean
$secret string | null
$algo string | null
리턴 boolean

validateOrFail() 공개 메소드

Validate the token or throw an exception
public validateOrFail ( string | null $secret = null, string | null $algo = null ) : boolean
$secret string | null
$algo string | null
리턴 boolean