PHP Class Lcobucci\JWT\Token

Since: 0.1.0
Author: Luís Otávio Cobucci Oblonczyk ([email protected])
Afficher le fichier Open project: lcobucci/jwt Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( array $headers = ['alg' => 'none'], array $claims = [], Lcobucci\JWT\Signature $signature = null, array $payload = ['', ''] ) Initializes the object
__toString ( ) : string Returns an encoded representation of the token
getClaim ( string $name, mixed $default = null ) : mixed Returns the value of a token claim
getClaims ( ) : array Returns the token claim set
getHeader ( string $name, mixed $default = null ) : mixed Returns the value of a token header
getHeaders ( ) : array Returns the token headers
getPayload ( ) : string Returns the token payload
hasClaim ( string $name ) : boolean Returns if the claim is configured
hasHeader ( string $name ) : boolean Returns if the header is configured
isExpired ( DateTimeInterfac\DateTimeInterface $now = null ) : boolean Determine if the token is expired.
validate ( ValidationData $data ) : boolean Validates if the token is valid
verify ( Lcobucci\JWT\Signer $signer, Lcobucci\JWT\Signer\Key | string $key ) : boolean Verify if the key matches with the one that created the signature

Private Methods

Méthode Description
getHeaderValue ( string $name ) : mixed Returns the value stored in header
getValidatableClaims ( ) : Generator Yields the validatable claims

Method Details

__construct() public méthode

Initializes the object
public __construct ( array $headers = ['alg' => 'none'], array $claims = [], Lcobucci\JWT\Signature $signature = null, array $payload = ['', ''] )
$headers array
$claims array
$signature Lcobucci\JWT\Signature
$payload array

__toString() public méthode

Returns an encoded representation of the token
public __toString ( ) : string
Résultat string

getClaim() public méthode

Returns the value of a token claim
public getClaim ( string $name, mixed $default = null ) : mixed
$name string
$default mixed
Résultat mixed

getClaims() public méthode

Returns the token claim set
public getClaims ( ) : array
Résultat array

getHeader() public méthode

Returns the value of a token header
public getHeader ( string $name, mixed $default = null ) : mixed
$name string
$default mixed
Résultat mixed

getHeaders() public méthode

Returns the token headers
public getHeaders ( ) : array
Résultat array

getPayload() public méthode

Returns the token payload
public getPayload ( ) : string
Résultat string

hasClaim() public méthode

Returns if the claim is configured
public hasClaim ( string $name ) : boolean
$name string
Résultat boolean

hasHeader() public méthode

Returns if the header is configured
public hasHeader ( string $name ) : boolean
$name string
Résultat boolean

isExpired() public méthode

Determine if the token is expired.
public isExpired ( DateTimeInterfac\DateTimeInterface $now = null ) : boolean
$now DateTimeInterfac\DateTimeInterface Defaults to the current time.
Résultat boolean

validate() public méthode

Validates if the token is valid
public validate ( ValidationData $data ) : boolean
$data ValidationData
Résultat boolean

verify() public méthode

Verify if the key matches with the one that created the signature
public verify ( Lcobucci\JWT\Signer $signer, Lcobucci\JWT\Signer\Key | string $key ) : boolean
$signer Lcobucci\JWT\Signer
$key Lcobucci\JWT\Signer\Key | string
Résultat boolean