Auth0-PHP

TokenInterface
in

Interface TokenInterface.

Table of Contents

getAudience()  : array<string|int, string>|null
Get the contents of the 'aud' claim, always returned an array. Null if not present.
getAuthorizedParty()  : string|null
Get the contents of the 'azp' claim. Null if not present.
getAuthTime()  : int|null
Get the contents of the 'auth_time' claim. Null if not present.
getExpiration()  : int|null
Get the contents of the 'exp' claim. Null if not present.
getIssued()  : int|null
Get the contents of the 'iat' claim. Null if not present.
getIssuer()  : string|null
Get the contents of the 'iss' claim. Null if not present.
getNonce()  : string|null
Get the contents of the 'nonce' claim. Null if not present.
getOrganization()  : string|null
Get the contents of the 'org_id' claim. Null if not present.
getSubject()  : string|null
Get the contents of the 'sub' claim. Null if not present.
parse()  : self
Parses a provided JWT string and prepare for verification and validation.
toArray()  : array<string|int, mixed>
Export the state of the Token object as a PHP array.
toJson()  : string
Export a JSON encoded object (as a string) representing the state of the Token object. Note that this is not itself an ID Token, but is useful for debugging your user state.
validate()  : self
Validate the claims of the token.
verify()  : self
Verify the signature of the Token using either RS256 or HS256.

Methods

getAudience()

Get the contents of the 'aud' claim, always returned an array. Null if not present.

public getAudience() : array<string|int, string>|null
Return values
array<string|int, string>|null

getAuthorizedParty()

Get the contents of the 'azp' claim. Null if not present.

public getAuthorizedParty() : string|null
Return values
string|null

getAuthTime()

Get the contents of the 'auth_time' claim. Null if not present.

public getAuthTime() : int|null
Return values
int|null

getExpiration()

Get the contents of the 'exp' claim. Null if not present.

public getExpiration() : int|null
Return values
int|null

getIssued()

Get the contents of the 'iat' claim. Null if not present.

public getIssued() : int|null
Return values
int|null

getIssuer()

Get the contents of the 'iss' claim. Null if not present.

public getIssuer() : string|null
Return values
string|null

getNonce()

Get the contents of the 'nonce' claim. Null if not present.

public getNonce() : string|null
Return values
string|null

getOrganization()

Get the contents of the 'org_id' claim. Null if not present.

public getOrganization() : string|null
Return values
string|null

getSubject()

Get the contents of the 'sub' claim. Null if not present.

public getSubject() : string|null
Return values
string|null

parse()

Parses a provided JWT string and prepare for verification and validation.

public parse() : self
Tags
throws
InvalidTokenException

When Token parsing fails. See the exception message for further details.

Return values
self

toArray()

Export the state of the Token object as a PHP array.

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

toJson()

Export a JSON encoded object (as a string) representing the state of the Token object. Note that this is not itself an ID Token, but is useful for debugging your user state.

public toJson() : string
Return values
string

validate()

Validate the claims of the token.

public validate([string|null $tokenIssuer = null ][, array<string|int, string>|null $tokenAudience = null ][, array<string|int, string>|null $tokenOrganization = null ][, string|null $tokenNonce = null ][, int|null $tokenMaxAge = null ][, int|null $tokenLeeway = null ][, int|null $tokenNow = null ]) : self
Parameters
$tokenIssuer : string|null = null

Optional. The value expected for the 'iss' claim.

$tokenAudience : array<string|int, string>|null = null

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

$tokenOrganization : array<string|int, string>|null = null

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

$tokenNonce : string|null = null

Optional. The value expected for the 'nonce' claim.

$tokenMaxAge : int|null = null

Optional. Maximum window of time in seconds since the 'auth_time' to accept the token.

$tokenLeeway : int|null = null

Optional. Leeway in seconds to allow during time calculations. Defaults to 60.

$tokenNow : int|null = null

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

Tags
throws
InvalidTokenException

When Token validation fails. See the exception message for further details.

Return values
self

verify()

Verify the signature of the Token using either RS256 or HS256.

public verify([string|null $tokenAlgorithm = null ][, string|null $tokenJwksUri = null ][, string|null $clientSecret = null ][, int|null $tokenCacheTtl = null ][, CacheItemPoolInterface|null $tokenCache = null ]) : self
Parameters
$tokenAlgorithm : string|null = null

Optional. Algorithm to use for verification. Expects either RS256 or HS256.

$tokenJwksUri : string|null = null

Optional. URI to the JWKS when verifying RS256 tokens.

$clientSecret : string|null = null

Optional. Client Secret found in the Application settings for verifying HS256 tokens.

$tokenCacheTtl : int|null = null

Optional. Time in seconds to keep JWKS records cached.

$tokenCache : CacheItemPoolInterface|null = null

Optional. A PSR-6 CacheItemPoolInterface instance to cache JWKS results within.

Tags
throws
InvalidTokenException

When Token signature verification fails. See the exception message for further details.

Return values
self

Search results