API - XOOPS 2.5.11 Beta 2
By monxoops.fr
JsonWebToken Class Reference

Public Member Functions

 __construct (KeyAbstract $key, $algorithm='HS256')
 
 setAlgorithm ($algorithm)
 
 decode ($jwtString, $assertClaims=array())
 
 create ($payload, $expirationOffset=0)
 

Protected Attributes

 $key
 
 $algorithm = 'HS256'
 
 $claims = array()
 

Constructor & Destructor Documentation

◆ __construct()

__construct ( KeyAbstract  $key,
  $algorithm = 'HS256' 
)

JsonWebToken constructor.

Parameters
KeyAbstract$keykey for signing/validating
string$algorithmalgorithm to use for signing/validating
Here is the call graph for this function:

Member Function Documentation

◆ create()

create (   $payload,
  $expirationOffset = 0 
)

Create a signed token string for a payload

Parameters
array | \ArrayObject$payloadtraversable set of claims, claim => value
int$expirationOffsetseconds from now that token will expire. If not specified, an "exp" claim will not be added or updated
Returns
string encoded and signed jwt string
Exceptions

DomainException;

Exceptions

InvalidArgumentException;

Exceptions

UnexpectedValueException;

Here is the call graph for this function:

◆ decode()

decode (   $jwtString,
  $assertClaims = array() 
)

Decode a JWT string, validating signature and well defined registered claims, and optionally validate against a list of supplied claims

Parameters
string$jwtStringstring containing the JWT to decode
array | \Traversable$assertClaimsassociative array, claim => value, of claims to assert
Returns
object|false
Here is the call graph for this function:

◆ setAlgorithm()

setAlgorithm (   $algorithm)
Parameters
string$algorithmalgorithm to use for signing/validating
Returns
JsonWebToken
Exceptions

DomainException

Here is the caller graph for this function:

Field Documentation

◆ $algorithm

$algorithm = 'HS256'
protected

◆ $claims

$claims = array()
protected

◆ $key

$key
protected

The documentation for this class was generated from the following file: