class CachingTokenProvider implements TokenProviderInterface

Properties

protected string|null $jwt

The cached token.

protected string|null $cacheKey

The context of the single cached token.

protected int $refreshAfter

The Unix timestamp after which the cached token must be re-minted.

Methods

__construct(TokenProviderInterface $provider, int $clockSkew = 30, Closure|null $cacheKeyResolver = null)

Create a new caching token provider instance.

string
getJwt()

Get the JWT, minting a fresh one when the cached token nears expiry.

int|null
expiresAt(string $jwt)

Extract the "exp" claim from the given JWT, if any.

Details

at line 32
__construct(TokenProviderInterface $provider, int $clockSkew = 30, Closure|null $cacheKeyResolver = null)

Create a new caching token provider instance.

Parameters

TokenProviderInterface $provider
int $clockSkew
Closure|null $cacheKeyResolver

at line 42
string getJwt()

Get the JWT, minting a fresh one when the cached token nears expiry.

Return Value

string

at line 64
protected int|null expiresAt(string $jwt)

Extract the "exp" claim from the given JWT, if any.

Parameters

string $jwt

Return Value

int|null