Token
in package
Table of Contents
- DEFAULT_SIGNER = \Corviz\Jwt\Signer\Hmac\Sha\Sha256Signer::class
- $headers : array<string|int, mixed>
- $headerValidators : array<string|int, mixed>
- $lastValidationIssue : string|null
- $payload : array<string|int, mixed>
- $signature : string
- $signer : Signer
- $validators : array<string|int, mixed>
- __construct() : mixed
- Constructor.
- assignHeaderValidator() : $this
- assignValidator() : $this
- create() : static
- fromAuthorizationBearer() : Token
- fromQueryString() : Token
- fromString() : Token
- getHeaders() : mixed
- getLastValidationIssue() : string|null
- getPayload() : mixed
- remove() : $this
- removeHeader() : $this
- setHeaders() : $this
- setPayload() : $this
- setSignature() : $this
- sign() : $this
- toString() : string
- validate() : bool
- with() : $this
- withHeader() : $this
- withSigner() : $this
- decodeSection() : string
- encodeSection() : string
- getDefaultSigner() : Signer
Constants
DEFAULT_SIGNER
public
mixed
DEFAULT_SIGNER
= \Corviz\Jwt\Signer\Hmac\Sha\Sha256Signer::class
Properties
$headers
private
array<string|int, mixed>
$headers
= []
$headerValidators
private
array<string|int, mixed>
$headerValidators
= []
$lastValidationIssue
private
string|null
$lastValidationIssue
= null
$payload
private
array<string|int, mixed>
$payload
= []
$signature
private
string
$signature
$signer
private
Signer
$signer
$validators
private
array<string|int, mixed>
$validators
= []
Methods
__construct()
Constructor.
public
__construct() : mixed
Return values
mixed —assignHeaderValidator()
public
assignHeaderValidator(Validator $validator) : $this
Parameters
- $validator : Validator
Return values
$this —assignValidator()
public
assignValidator(Validator $validator) : $this
Parameters
- $validator : Validator
Return values
$this —create()
public
static create() : static
Return values
static —fromAuthorizationBearer()
public
static fromAuthorizationBearer() : Token
Tags
Return values
Token —fromQueryString()
public
static fromQueryString([ $param = 'token' ]) : Token
Parameters
Tags
Return values
Token —fromString()
public
static fromString(string $token) : Token
Parameters
- $token : string
Tags
Return values
Token —getHeaders()
public
getHeaders([string|null $index = null ]) : mixed
Parameters
- $index : string|null = null
Return values
mixed —getLastValidationIssue()
public
getLastValidationIssue() : string|null
Return values
string|null —getPayload()
public
getPayload([string|null $index = null ]) : mixed
Parameters
- $index : string|null = null
Return values
mixed —remove()
public
remove(string $index) : $this
Parameters
- $index : string
Return values
$this —removeHeader()
public
removeHeader(string $index) : $this
Parameters
- $index : string
Return values
$this —setHeaders()
public
setHeaders(array<string|int, mixed> $headers) : $this
Parameters
- $headers : array<string|int, mixed>
Return values
$this —setPayload()
public
setPayload(array<string|int, mixed> $payload) : $this
Parameters
- $payload : array<string|int, mixed>
Return values
$this —setSignature()
public
setSignature(string $signature) : $this
Parameters
- $signature : string
Return values
$this —sign()
public
sign(mixed $secret) : $this
Parameters
- $secret : mixed
Return values
$this —toString()
public
toString() : string
Return values
string —validate()
public
validate(mixed $secret) : bool
Parameters
- $secret : mixed
Return values
bool —with()
public
with(string $index, mixed $value) : $this
Parameters
- $index : string
- $value : mixed
Return values
$this —withHeader()
public
withHeader(string $index, mixed $value) : $this
Parameters
- $index : string
- $value : mixed
Return values
$this —withSigner()
public
withSigner(Signer $signer) : $this
Parameters
- $signer : Signer
Return values
$this —decodeSection()
private
static decodeSection(string $encoded) : string
Parameters
- $encoded : string
Return values
string —encodeSection()
private
static encodeSection(string $value) : string
Parameters
- $value : string
Return values
string —getDefaultSigner()
private
static getDefaultSigner() : Signer