abstract class Provider

Constants

ALGO_HS256

ALGO_HS384

ALGO_HS512

ALGO_RS256

ALGO_RS384

ALGO_RS512

ALGO_ES256

ALGO_ES384

ALGO_ES512

Methods

__construct(string $secret, string $algo, array $keys)

Constructor.

setAlgo(string $algo)

Set the algorithm used to sign the token.

string
getAlgo()

Get the algorithm used to sign the token.

setSecret(string $secret)

Set the secret used to sign the token.

string
getSecret()

Get the secret used to sign the token.

setKeys(array $keys)

Set the keys used to sign the token.

array
getKeys()

Get the array of keys used to sign tokens with an asymmetric algorithm.

string|null
getPublicKey()

Get the public key used to sign tokens with an asymmetric algorithm.

string|null
getPrivateKey()

Get the private key used to sign tokens with an asymmetric algorithm.

string|null
getPassphrase()

Get the passphrase used to sign tokens with an asymmetric algorithm.

mixed
getSigningKey()

Get the key used to sign the tokens.

mixed
getVerificationKey()

Get the key used to verify the tokens.

bool
isAsymmetric()

Determine if the algorithm is asymmetric, and thus requires a public/private key combo.

void
onConfigurationChanged()

Hook fired after any of algo/secret/keys is mutated.

Details

at line 32
__construct(string $secret, string $algo, array $keys)

Constructor.

Parameters

string $secret
string $algo
array $keys

at line 47
Provider setAlgo(string $algo)

Set the algorithm used to sign the token.

Boot-only. Providers are cached on the singleton JwtManager; runtime mutation affects every subsequent request and races across coroutines.

Parameters

string $algo

Return Value

Provider

at line 58
string getAlgo()

Get the algorithm used to sign the token.

Return Value

string

at line 71
Provider setSecret(string $secret)

Set the secret used to sign the token.

Boot-only. Providers are cached on the singleton JwtManager; runtime mutation affects every subsequent request and races across coroutines.

Parameters

string $secret

Return Value

Provider

at line 82
string getSecret()

Get the secret used to sign the token.

Return Value

string

at line 95
Provider setKeys(array $keys)

Set the keys used to sign the token.

Boot-only. Providers are cached on the singleton JwtManager; runtime mutation affects every subsequent request and races across coroutines.

Parameters

array $keys

Return Value

Provider

at line 106
array getKeys()

Get the array of keys used to sign tokens with an asymmetric algorithm.

Return Value

array

at line 114
string|null getPublicKey()

Get the public key used to sign tokens with an asymmetric algorithm.

Return Value

string|null

at line 122
string|null getPrivateKey()

Get the private key used to sign tokens with an asymmetric algorithm.

Return Value

string|null

at line 131
string|null getPassphrase()

Get the passphrase used to sign tokens with an asymmetric algorithm.

Return Value

string|null

at line 139
protected mixed getSigningKey()

Get the key used to sign the tokens.

Return Value

mixed

at line 147
protected mixed getVerificationKey()

Get the key used to verify the tokens.

Return Value

mixed

at line 155
abstract protected bool isAsymmetric()

Determine if the algorithm is asymmetric, and thus requires a public/private key combo.

Return Value

bool

at line 163
protected void onConfigurationChanged()

Hook fired after any of algo/secret/keys is mutated.

Subclasses that cache derived state (signers, configuration objects) override this to rebuild it so the new values actually take effect.

Return Value

void