Verifier
in package
Table of Contents
Properties
- $algorithm : string|null
- $cache : CacheItemPoolInterface|null
- $cacheExpires : int|null
- $clientSecret : string|null
- $configuration : SdkConfiguration
- $headers : array<string|int, mixed>
- $jwksUri : string|null
- $mockedHttpResponses : array<string|int, mixed>|null
- $payload : string
- $signature : string
Methods
- __construct() : mixed
- Constructor for the Token Verifier class.
- verify() : self
- Verify the token signature.
- getKey() : OpenSSLAsymmetricKey
- Query a JWKS endpoint for a matching key. Parse and return a OpenSSLAsymmetricKey (PHP 8.0+) suitable for verification.
- getKeySet() : array<int|string, mixed>
- Query a JWKS endpoint and return an array representing the key set.
Properties
$algorithm read-only
private
string|null
$algorithm
= null
$cache read-only
private
CacheItemPoolInterface|null
$cache
= null
$cacheExpires read-only
private
int|null
$cacheExpires
= null
$clientSecret read-only
private
string|null
$clientSecret
= null
$configuration read-only
private
SdkConfiguration
$configuration
$headers
private
array<string|int, mixed>
$headers
$jwksUri read-only
private
string|null
$jwksUri
= null
$mockedHttpResponses
private
array<string|int, mixed>|null
$mockedHttpResponses
= null
$payload read-only
private
string
$payload
$signature read-only
private
string
$signature
Methods
__construct()
Constructor for the Token Verifier class.
public
__construct(SdkConfiguration $configuration, string $payload, string $signature, array<string|int, int|string> $headers[, null|string $algorithm = null ][, null|string $jwksUri = null ][, null|string $clientSecret = null ][, null|int $cacheExpires = null ][, null|CacheItemPoolInterface $cache = null ][, null|array<string|int, object> &$mockedHttpResponses = null ]) : mixed
Parameters
- $configuration : SdkConfiguration
-
SDK configuration options.
- $payload : string
-
a string representing the headers and claims portions of a JWT
- $signature : string
-
a string representing the signature portion of a JWT
- $headers : array<string|int, int|string>
-
An array of the headers for the JWT. Expects an 'alg' header, and in the case of RS256, a 'kid' header.
- $algorithm : null|string = null
-
Optional. Algorithm to use for verification. Expects either RS256 or HS256. Defaults to RS256.
- $jwksUri : null|string = null
-
Optional. URI to the JWKS when verifying RS256 tokens.
- $clientSecret : null|string = null
-
Optional. Client Secret found in the Application settings for verifying HS256 tokens.
- $cacheExpires : null|int = null
-
Optional. Time in seconds to keep JWKS records cached.
- $cache : null|CacheItemPoolInterface = null
-
Optional. A PSR-6 CacheItemPoolInterface instance to cache JWKS results within.
- $mockedHttpResponses : null|array<string|int, object> = null
-
Optional. Only intended for unit testing purposes.
verify()
Verify the token signature.
public
verify() : self
Tags
Return values
selfgetKey()
Query a JWKS endpoint for a matching key. Parse and return a OpenSSLAsymmetricKey (PHP 8.0+) suitable for verification.
private
getKey(string $kid) : OpenSSLAsymmetricKey
Parameters
- $kid : string
-
the 'kid' header value to use for key lookup
Tags
Return values
OpenSSLAsymmetricKeygetKeySet()
Query a JWKS endpoint and return an array representing the key set.
private
getKeySet([null|string $expectsKid = null ]) : array<int|string, mixed>
Parameters
- $expectsKid : null|string = null
-
Optional. A key id we're currently expecting to retrieve. When retrieving a cache response, if the key isn't present, it will invalid the cache and fetch an updated JWKS.