TimeBasedValidator
in package
implements
JwtValidator
AbstractYes
Provides a common base class for time based validators.
Table of Contents
Interfaces
- JwtValidator
- Defines a validator for JWT decoding.
Methods
- __construct() : mixed
- validate() : void
- Validates the claims provided in a JWT.
Methods
__construct()
public
__construct(int $leeway, callable(): int|null $time, array<string|int, mixed> $claims) : mixed
Parameters
- $leeway : int
-
Amount of leeway applied on the timestamp before comparing.
- $time : callable(): int|null
-
Callable that return the current timestamp, will use PHP's time() if null.
- $claims : array<string|int, mixed>
validate()
Validates the claims provided in a JWT.
public
abstract validate(object $headers, object $payload) : void
If values are not as expected, an exception should be thrown, preferably one implementing WithPayload.
Parameters
- $headers : object
-
Headers section from the provided JWT.
- $payload : object
-
Payload section from the provided JWT.