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 34
__construct(string $secret, string $algo, array $keys)

Constructor.

Parameters

string $secret
string $algo
array $keys

at line 51
Provider setAlgo(string $algo)

Set the algorithm used to sign the token.

On a provider cached by the shared JwtManager, runtime mutation affects every subsequent request and races across coroutines.

Parameters

string $algo

Return Value

Provider

at line 63
string getAlgo()

Get the algorithm used to sign the token.

Return Value

string

at line 76
Provider setSecret(string $secret)

Set the secret used to sign the token.

On a provider cached by the shared JwtManager, runtime mutation affects every subsequent request and races across coroutines.

Parameters

string $secret

Return Value

Provider

at line 88
string getSecret()

Get the secret used to sign the token.

Return Value

string

at line 101
Provider setKeys(array $keys)

Set the keys used to sign the token.

On a provider cached by the shared JwtManager, runtime mutation affects every subsequent request and races across coroutines.

Parameters

array $keys

Return Value

Provider

at line 113
array getKeys()

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

Return Value

array

at line 121
string|null getPublicKey()

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

Return Value

string|null

at line 129
string|null getPrivateKey()

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

Return Value

string|null

at line 138
string|null getPassphrase()

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

Return Value

string|null

at line 146
protected mixed getSigningKey()

Get the key used to sign the tokens.

Return Value

mixed

at line 154
protected mixed getVerificationKey()

Get the key used to verify the tokens.

Return Value

mixed

at line 162
abstract protected bool isAsymmetric()

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

Return Value

bool

at line 170
protected void onConfigurationChanged()

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

Subclasses that cache derived state (signers, configuration objects) override this to invalidate it so the new values take effect on next use.

Return Value

void