Validator
in package
implements
ValidatorInterface
Table of Contents
Interfaces
Properties
- $claims : array<string|int, mixed>
Methods
- __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.
- events() : self
- Validate the 'events' claim.
- expiration() : self
- Validate the 'exp' claim.
- getClaim() : null|array<string|int, mixed>|bool|int|string
- Return a claim by it's key. Null if not present.
- identifier() : self
- Validate the 'sid' claim is present.
- 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' and `org_name` claims.
- subject() : self
- Validate the 'sub' claim is present.
Properties
$claims
private
array<string|int, mixed>
$claims
Methods
__construct()
Constructor for the Token Validator class.
public
__construct(array<string, array<string|int, int|string>|bool|int|string> $claims) : mixed
Parameters
- $claims : array<string, array<string|int, int|string>|bool|int|string>
-
array representing the claims of a JWT
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
Return values
selfauthorizedParty()
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
Return values
selfauthTime()
Validate the 'auth_time' claim.
public
authTime(int $maxAge[, int $leeway = 60 ][, null|int $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 : null|int = null
-
Optional. Unix timestamp representing the current point in time to use for time calculations.
Tags
Return values
selfevents()
Validate the 'events' claim.
public
events(array<string|int, string> $expects) : self
Parameters
- $expects : array<string|int, string>
-
An array of allowed values for the 'events' claim. Successful if ANY match.
Tags
Return values
selfexpiration()
Validate the 'exp' claim.
public
expiration([int $leeway = 60 ][, null|int $now = null ]) : self
Parameters
- $leeway : int = 60
-
leeway in seconds to allow during time calculations
- $now : null|int = null
-
Optional. Unix timestamp representing the current point in time to use for time calculations.
Tags
Return values
selfgetClaim()
Return a claim by it's key. Null if not present.
public
getClaim(string $key) : null|array<string|int, mixed>|bool|int|string
Parameters
- $key : string
-
the claim key to search for
Return values
null|array<string|int, mixed>|bool|int|stringidentifier()
Validate the 'sid' claim is present.
public
identifier() : self
Tags
Return values
selfissued()
Validate the 'iat' claim is present.
public
issued() : self
Tags
Return values
selfissuer()
Validate the 'iss' claim.
public
issuer(string $expects) : self
Parameters
- $expects : string
-
the value to compare with the claim
Tags
Return values
selfnonce()
Validate the 'nonce' claim.
public
nonce(string $expects) : self
Parameters
- $expects : string
-
the value to compare with the claim
Tags
Return values
selforganization()
Validate the 'org_id' and `org_name` claims.
public
organization(array<string|int, string> $expects) : self
Parameters
- $expects : array<string|int, string>
-
An array of allowed values for the 'org_id' or
org_nameclaim. Successful if ANY match.
Tags
Return values
selfsubject()
Validate the 'sub' claim is present.
public
subject() : self