Interface to represent an HWT client. More...
Inheritance diagram for ceLTIc\LTI\Jwt\ClientInterface:Public Member Functions | |
| bool | hasJwt () |
| Check if a JWT is defined. | |
| bool | isEncrypted () |
| Check if a JWT's content is encrypted. | |
| bool | load (string $jwtString, ?string $privateKey=null) |
| Load a JWT from a string. | |
| array | getJweHeaders () |
| Get the value of the JWE headers. | |
| bool | hasHeader (string $name) |
| Check whether a JWT has a header with the specified name. | |
| string null | getHeader (string $name, ?string $defaultValue=null) |
| Get the value of the header with the specified name. | |
| array | getHeaders () |
| Get the value of the headers. | |
| bool | hasClaim (string $name) |
| Check whether a JWT has a claim with the specified name. | |
| int float string bool array object null | getClaim (string $name, int|float|string|bool|array|object|null $defaultValue=null) |
| Get the value of the claim with the specified name. | |
| array | getPayload () |
| Get the value of the payload. | |
| bool | verify (?string $publicKey, ?string $jku=null) |
| Verify the signature of the JWT. | |
| bool | verifySignature (?string &$publicKey, ?string $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 (array $payload, string $signatureMethod, string $privateKey, ?string $kid=null, ?string $jku=null, ?string $encryptionMethod=null, ?string $publicKey=null) |
| Sign the JWT. | |
| static string null | generateKey (string $signatureMethod='RS256') |
| Generate a new private key in PEM format. | |
| static string null | getPublicKey (string $privateKey) |
| Get the public key for a private key. | |
| static array | getJWKS (string $pemKey, string $signatureMethod, ?string $kid=null) |
| 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 ceLTIc\LTI\Jwt\FirebaseClient, and ceLTIc\LTI\Jwt\WebTokenClient.
| int float string bool array object null ceLTIc\LTI\Jwt\ClientInterface::getClaim | ( | string | $name, |
| int|float|string|bool|array|object|null | $defaultValue = null ) |
Get the value of the claim with the specified name.
| string | $name | Claim name |
| int | float | string | bool | array | object | null | $defaultValue | Default value |
Implemented in ceLTIc\LTI\Jwt\FirebaseClient, and ceLTIc\LTI\Jwt\WebTokenClient.
| string null ceLTIc\LTI\Jwt\ClientInterface::getHeader | ( | string | $name, |
| ?string | $defaultValue = null ) |
Get the value of the header with the specified name.
| string | $name | Header name |
| string | null | $defaultValue | Default value |
Implemented in ceLTIc\LTI\Jwt\FirebaseClient, and ceLTIc\LTI\Jwt\WebTokenClient.
| array ceLTIc\LTI\Jwt\ClientInterface::getHeaders | ( | ) |
Get the value of the headers.
Implemented in ceLTIc\LTI\Jwt\FirebaseClient, and ceLTIc\LTI\Jwt\WebTokenClient.
| array ceLTIc\LTI\Jwt\ClientInterface::getJweHeaders | ( | ) |
Get the value of the JWE headers.
Implemented in ceLTIc\LTI\Jwt\FirebaseClient, and ceLTIc\LTI\Jwt\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 | null | $kid | Key ID (optional) |
Implemented in ceLTIc\LTI\Jwt\FirebaseClient, and ceLTIc\LTI\Jwt\WebTokenClient.
|
static |
Get the value of the headers for the last signed JWT (before any encryption).
Implemented in ceLTIc\LTI\Jwt\FirebaseClient, and ceLTIc\LTI\Jwt\WebTokenClient.
|
static |
Get the value of the payload for the last signed JWT (before any encryption).
Implemented in ceLTIc\LTI\Jwt\FirebaseClient, and ceLTIc\LTI\Jwt\WebTokenClient.
| array ceLTIc\LTI\Jwt\ClientInterface::getPayload | ( | ) |
Get the value of the payload.
Implemented in ceLTIc\LTI\Jwt\FirebaseClient, and ceLTIc\LTI\Jwt\WebTokenClient.
|
static |
Get the public key for a private key.
| string | $privateKey | Private key in PEM format |
Implemented in ceLTIc\LTI\Jwt\FirebaseClient, and ceLTIc\LTI\Jwt\WebTokenClient.
|
static |
Return an array of supported signature algorithms.
Implemented in ceLTIc\LTI\Jwt\FirebaseClient, and ceLTIc\LTI\Jwt\WebTokenClient.
| bool ceLTIc\LTI\Jwt\ClientInterface::hasClaim | ( | string | $name | ) |
Check whether a JWT has a claim with the specified name.
| string | $name | Claim name |
Implemented in ceLTIc\LTI\Jwt\FirebaseClient, and ceLTIc\LTI\Jwt\WebTokenClient.
| bool ceLTIc\LTI\Jwt\ClientInterface::hasHeader | ( | string | $name | ) |
Check whether a JWT has a header with the specified name.
| string | $name | Header name |
Implemented in ceLTIc\LTI\Jwt\FirebaseClient, and ceLTIc\LTI\Jwt\WebTokenClient.
| bool ceLTIc\LTI\Jwt\ClientInterface::hasJwt | ( | ) |
Check if a JWT is defined.
Implemented in ceLTIc\LTI\Jwt\FirebaseClient, and ceLTIc\LTI\Jwt\WebTokenClient.
| bool ceLTIc\LTI\Jwt\ClientInterface::isEncrypted | ( | ) |
Check if a JWT's content is encrypted.
Implemented in ceLTIc\LTI\Jwt\FirebaseClient, and ceLTIc\LTI\Jwt\WebTokenClient.
| bool ceLTIc\LTI\Jwt\ClientInterface::load | ( | string | $jwtString, |
| ?string | $privateKey = null ) |
Load a JWT from a string.
| string | $jwtString | JWT string |
| string | null | $privateKey | Private key in PEM format for decrypting encrypted tokens (optional) |
Implemented in ceLTIc\LTI\Jwt\FirebaseClient, and ceLTIc\LTI\Jwt\WebTokenClient.
|
static |
Sign the JWT.
| array | $payload | Payload |
| string | $signatureMethod | Signature method |
| string | $privateKey | Private key in PEM format |
| string | null | $kid | Key ID (optional) |
| string | null | $jku | JSON Web Key URL (optional) |
| string | null | $encryptionMethod | Encryption method (optional) |
| string | null | $publicKey | Public key of recipient for content encryption (optional) |
Implemented in ceLTIc\LTI\Jwt\FirebaseClient, and ceLTIc\LTI\Jwt\WebTokenClient.
| bool ceLTIc\LTI\Jwt\ClientInterface::verify | ( | ?string | $publicKey, |
| ?string | $jku = null ) |
Verify the signature of the JWT.
| string | null | $publicKey | Public key of issuer |
| string | null | $jku | JSON Web Key URL of issuer (optional) |
Implemented in ceLTIc\LTI\Jwt\FirebaseClient, and ceLTIc\LTI\Jwt\WebTokenClient.
| bool ceLTIc\LTI\Jwt\ClientInterface::verifySignature | ( | ?string & | $publicKey, |
| ?string | $jku = null ) |
Verify the signature of the JWT.
If a new public key is fetched and used to successfully verify the signature, the value of the publicKey parameter is updated.
| string | null | $publicKey | Public key of issuer (passed by reference) |
| string | null | $jku | JSON Web Key URL of issuer (optional) |
Implemented in ceLTIc\LTI\Jwt\FirebaseClient, and ceLTIc\LTI\Jwt\WebTokenClient.