Interface to represent an HWT client. More...
Public Member Functions | |
| bool | hasJwt () |
| Check if a JWT is defined. | |
| bool | isEncrypted () |
| Check if a JWT's content is encrypted. | |
| bool | load ($jwtString, $privateKey=null) |
| Load a JWT from a string. | |
| array | getJweHeaders () |
| Get the value of the JWE headers. | |
| bool | hasHeader ($name) |
| Check whether a JWT has a header with the specified name. | |
| string | getHeader ($name, $defaultValue=null) |
| Get the value of the header with the specified name. | |
| array | getHeaders () |
| Get the value of the headers. | |
| bool | hasClaim ($name) |
| Check whether a JWT has a claim with the specified name. | |
| string array object | getClaim ($name, $defaultValue=null) |
| Get the value of the claim with the specified name. | |
| array | getPayload () |
| Get the value of the payload. | |
| bool | verify ($publicKey, $jku=null) |
| Verify the signature of the JWT. | |
Static Public Member Functions | |
| static string[] | getSupportedAlgorithms () |
| Return an array of supported signature algorithms. | |
| static array | getLastHeaders () |
| Get the value of the headers for the last signed JWT (before any encryption). | |
| static array | getLastPayload () |
| Get the value of the payload for the last signed JWT (before any encryption). | |
| static string | sign ($payload, $signatureMethod, $privateKey, $kid=null, $jku=null, $encryptionMethod=null, $publicKey=null) |
| Sign the JWT. | |
| static string null | generateKey ($signatureMethod='RS256') |
| Generate a new private key in PEM format. | |
| static string | getPublicKey ($privateKey) |
| Get the public key for a private key. | |
| static array | getJWKS ($pemKey, $signatureMethod, $kid) |
| Get the public JWKS from a key in PEM format. | |
Interface to represent an HWT client.
|
static |
Generate a new private key in PEM format.
| string | $signatureMethod | Signature method |
Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.
| string array object getClaim | ( | $name, | |
$defaultValue = null |
|||
| ) |
Get the value of the claim with the specified name.
| string | $name | Claim name |
| string | $defaultValue | Default value |
Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.
| string getHeader | ( | $name, | |
$defaultValue = null |
|||
| ) |
Get the value of the header with the specified name.
| string | $name | Header name |
| string | $defaultValue | Default value |
Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.
| array getHeaders | ( | ) |
Get the value of the headers.
Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.
| array getJweHeaders | ( | ) |
Get the value of the JWE headers.
Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.
|
static |
Get the public JWKS from a key in PEM format.
| string | $pemKey | Private or public key in PEM format |
| string | $signatureMethod | Signature method |
| string | $kid | Key ID (optional) |
Implemented in SpomkyLabsClient, WebTokenClient, and FirebaseClient.
|
static |
Get the value of the headers for the last signed JWT (before any encryption).
Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.
|
static |
Get the value of the payload for the last signed JWT (before any encryption).
Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.
| array getPayload | ( | ) |
Get the value of the payload.
Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.
|
static |
Get the public key for a private key.
| string | $privateKey | Private key in PEM format |
Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.
|
static |
Return an array of supported signature algorithms.
Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.
| bool hasClaim | ( | $name | ) |
Check whether a JWT has a claim with the specified name.
| string | $name | Claim name |
Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.
| bool hasHeader | ( | $name | ) |
Check whether a JWT has a header with the specified name.
| string | $name | Header name |
Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.
| bool hasJwt | ( | ) |
Check if a JWT is defined.
Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.
| bool isEncrypted | ( | ) |
Check if a JWT's content is encrypted.
Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.
| bool load | ( | $jwtString, | |
$privateKey = null |
|||
| ) |
Load a JWT from a string.
| string | $jwtString | JWT string |
| string | $privateKey | Private key in PEM format for decrypting encrypted tokens (optional) |
Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.
|
static |
Sign the JWT.
| array | $payload | Payload |
| string | $signatureMethod | Signature method |
| string | $privateKey | Private key in PEM format |
| string | $kid | Key ID (optional) |
| string | $jku | JSON Web Key URL (optional) |
| string | $encryptionMethod | Encryption method (optional) |
| string | $publicKey | Public key of recipient for content encryption (optional) |
Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.
| bool verify | ( | $publicKey, | |
$jku = null |
|||
| ) |
Verify the signature of the JWT.
| string | $publicKey | Public key of issuer |
| string | $jku | JSON Web Key URL of issuer (optional) |
Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.