Auth0-PHP

Validator
in package
implements ValidatorInterface

Class Validator.

Interfaces, Classes, Traits and Enums

ValidatorInterface
Interface ValidatorInterface.

Table of Contents

$claims  : array<string|int, mixed>
__construct()  : mixed
Constructor for the Token Validator class.
audience()  : self
Validate the 'aud' claim.
authorizedParty()  : self
Validate the 'azp' claim.
authTime()  : self
Validate the 'auth_time' claim.
expiration()  : self
Validate the 'exp' claim.
issued()  : self
Validate the 'iat' claim is present.
issuer()  : self
Validate the 'iss' claim.
nonce()  : self
Validate the 'nonce' claim.
organization()  : self
Validate the 'org_id' claim.
subject()  : self
Validate the 'sub' claim is present.
getClaim()  : array<string|int, mixed>|int|string|null
Return a claim by it's key. Null if not present.

Properties

$claims

private array<string|int, mixed> $claims

Methods

__construct()

Constructor for the Token Validator class.

public __construct(array<string, (int|string)[]|int|string> $claims) : mixed
Parameters
$claims : array<string, (int|string)[]|int|string>

array representing the claims of a JWT

Return values
mixed

audience()

Validate the 'aud' claim.

public audience(array<string|int, string> $expects) : self
Parameters
$expects : array<string|int, string>

An array of allowed values for the 'aud' claim. Successful if ANY match.

Tags
throws
InvalidTokenException

when claim validation fails

Return values
self

authorizedParty()

Validate the 'azp' claim.

public authorizedParty(array<string|int, string> $expects) : self
Parameters
$expects : array<string|int, string>

An array of allowed values for the 'azp' claim. Successful if ANY match.

Tags
throws
InvalidTokenException

when claim validation fails

Return values
self

authTime()

Validate the 'auth_time' claim.

public authTime(int $maxAge[, int $leeway = 60 ][, int|null $now = null ]) : self
Parameters
$maxAge : int

maximum window of time in seconds since the 'auth_time' to accept the token

$leeway : int = 60

leeway in seconds to allow during time calculations

$now : int|null = null

Optional. Unix timestamp representing the current point in time to use for time calculations.

Tags
throws
InvalidTokenException

when claim validation fails

Return values
self

expiration()

Validate the 'exp' claim.

public expiration([int $leeway = 60 ][, int|null $now = null ]) : self
Parameters
$leeway : int = 60

leeway in seconds to allow during time calculations

$now : int|null = null

Optional. Unix timestamp representing the current point in time to use for time calculations.

Tags
throws
InvalidTokenException

when claim validation fails

Return values
self

issued()

Validate the 'iat' claim is present.

public issued() : self
Tags
throws
InvalidTokenException

when claim validation fails

Return values
self

issuer()

Validate the 'iss' claim.

public issuer(string $expects) : self
Parameters
$expects : string

the value to compare with the claim

Tags
throws
InvalidTokenException

when claim validation fails

Return values
self

nonce()

Validate the 'nonce' claim.

public nonce(string $expects) : self
Parameters
$expects : string

the value to compare with the claim

Tags
throws
InvalidTokenException

when claim validation fails

Return values
self

organization()

Validate the 'org_id' claim.

public organization(array<string|int, string> $expects) : self
Parameters
$expects : array<string|int, string>

An array of allowed values for the 'org_id' claim. Successful if ANY match.

Tags
throws
InvalidTokenException

when claim validation fails

Return values
self

subject()

Validate the 'sub' claim is present.

public subject() : self
Tags
throws
InvalidTokenException

when claim validation fails

Return values
self

getClaim()

Return a claim by it's key. Null if not present.

private getClaim(string $key) : array<string|int, mixed>|int|string|null
Parameters
$key : string

the claim key to search for

Return values
array<string|int, mixed>|int|string|null

Search results