TokenExpirationValidator
extends TimeBasedValidator
in package
Provides a validator that checks whether a token has expired.
Table of Contents
Constants
- CLAIM_EXP = 'exp'
- Name of "exp" claim.
- CLAIMS = [self::CLAIM_EXP]
- Default value for the constructor $claims parameter.
Methods
- __construct() : mixed
- validate() : void
- Validates the claims provided in a JWT.
Constants
CLAIM_EXP
Name of "exp" claim.
public
string
CLAIM_EXP
= 'exp'
CLAIMS
Default value for the constructor $claims parameter.
public
array<string|int, string>
CLAIMS
= [self::CLAIM_EXP]
Methods
__construct()
public
__construct([int $leeway = 0 ][, mixed $time = null ][, array<string|int, mixed> $claims = self::CLAIMS ]) : mixed
Parameters
- $leeway : int = 0
-
Amount of leeway applied on the timestamp before comparing.
- $time : mixed = null
-
Callable that return the current timestamp, will use PHP's time() if null.
- $claims : array<string|int, mixed> = self::CLAIMS
validate()
Validates the claims provided in a JWT.
public
validate(object $headers, object $payload) : void
Parameters
- $headers : object
-
Headers section from the provided JWT.
- $payload : object
-
Payload section from the provided JWT.