Class to implement the JWT interface using the Web Token JWT Framework library from https://web-token.spomky-labs.com. More...
Public Member Functions | |
| hasJwt () | |
| Check if a JWT is defined. | |
| isEncrypted () | |
| Check if a JWT's content is encrypted. | |
| load ($jwtString, $privateKey=null) | |
| Load a JWT from a string. | |
| getJweHeaders () | |
| Get the value of the JWE headers. | |
| hasHeader ($name) | |
| Check whether a JWT has a header with the specified name. | |
| getHeader ($name, $defaultValue=null) | |
| Get the value of the header with the specified name. | |
| getHeaders () | |
| Get the value of the headers. | |
| hasClaim ($name) | |
| Check whether a JWT has a claim with the specified name. | |
| getClaim ($name, $defaultValue=null) | |
| Get the value of the claim with the specified name. | |
| getPayload () | |
| Get the value of the payload. | |
| verify ($publicKey, $jku=null) | |
| Verify the signature of the JWT. | |
| hasJwt () | |
| Check if a JWT is defined. | |
| isEncrypted () | |
| Check if a JWT's content is encrypted. | |
| load ($jwtString, $privateKey=null) | |
| Load a JWT from a string. | |
| getJweHeaders () | |
| Get the value of the JWE headers. | |
| hasHeader ($name) | |
| Check whether a JWT has a header with the specified name. | |
| getHeader ($name, $defaultValue=null) | |
| Get the value of the header with the specified name. | |
| getHeaders () | |
| Get the value of the headers. | |
| hasClaim ($name) | |
| Check whether a JWT has a claim with the specified name. | |
| getClaim ($name, $defaultValue=null) | |
| Get the value of the claim with the specified name. | |
| getPayload () | |
| Get the value of the payload. | |
| verify ($publicKey, $jku=null) | |
| Verify the signature of the JWT. | |
Static Public Member Functions | |
| static | getSupportedAlgorithms () |
| Return an array of supported signature algorithms. | |
| static | getLastHeaders () |
| Get the value of the headers for the last signed JWT (before any encryption). | |
| static | getLastPayload () |
| Get the value of the payload for the last signed JWT (before any encryption). | |
| static | sign ($payload, $signatureMethod, $privateKey, $kid=null, $jku=null, $encryptionMethod=null, $publicKey=null) |
| Sign the JWT. | |
| static | generateKey ($signatureMethod='RS256') |
| Generate a new private key in PEM format. | |
| static | getPublicKey ($privateKey) |
| Get the public key for a private key. | |
| static | getJWKS ($pemKey, $signatureMethod, $kid) |
| Get the public JWKS from a key in PEM format. | |
| static | getSupportedAlgorithms () |
| Return an array of supported signature algorithms. | |
| static | getLastHeaders () |
| Get the value of the headers for the last signed JWT (before any encryption). | |
| static | getLastPayload () |
| Get the value of the payload for the last signed JWT (before any encryption). | |
| static | sign ($payload, $signatureMethod, $privateKey, $kid=null, $jku=null, $encryptionMethod=null, $publicKey=null) |
| Sign the JWT. | |
| static | generateKey ($signatureMethod='RS256') |
| Generate a new private key in PEM format. | |
| static | getPublicKey ($privateKey) |
| Get the public key for a private key. | |
| static | getJWKS ($pemKey, $signatureMethod, $kid) |
| Get the public JWKS from a key in PEM format. | |
Data Fields | |
| const | SUPPORTED_ALGORITHMS = array('RS256', 'RS384', 'RS512') |
| Supported signature algorithms. | |
Class to implement the JWT interface using the Web Token JWT Framework library from https://web-token.spomky-labs.com.
Definition at line 22 of file WebTokenClient.php.
|
static |
Generate a new private key in PEM format.
| string | $signatureMethod | Signature method |
Implements ClientInterface.
Definition at line 428 of file WebTokenClient.php.
| getClaim | ( | $name, | |
$defaultValue = null |
|||
| ) |
Get the value of the claim with the specified name.
| string | $name | Claim name |
| int | string | bool | array | object | null | $defaultValue | Default value |
Implements ClientInterface.
Definition at line 229 of file WebTokenClient.php.
| getHeader | ( | $name, | |
$defaultValue = null |
|||
| ) |
Get the value of the header with the specified name.
| string | $name | Header name |
| string | null | $defaultValue | Default value |
Implements ClientInterface.
Definition at line 173 of file WebTokenClient.php.
| getHeaders | ( | ) |
Get the value of the headers.
Implements ClientInterface.
Definition at line 189 of file WebTokenClient.php.
| getJweHeaders | ( | ) |
Get the value of the JWE headers.
Implements ClientInterface.
Definition at line 136 of file WebTokenClient.php.
References WebTokenClient\isEncrypted().
|
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) |
Implements ClientInterface.
Definition at line 454 of file WebTokenClient.php.
|
static |
Get the value of the headers for the last signed JWT (before any encryption).
Implements ClientInterface.
Definition at line 204 of file WebTokenClient.php.
|
static |
Get the value of the payload for the last signed JWT (before any encryption).
Implements ClientInterface.
Definition at line 255 of file WebTokenClient.php.
| getPayload | ( | ) |
Get the value of the payload.
Implements ClientInterface.
Definition at line 245 of file WebTokenClient.php.
|
static |
Get the public key for a private key.
| string | $privateKey | Private key in PEM format |
Implements ClientInterface.
Definition at line 440 of file WebTokenClient.php.
|
static |
Return an array of supported signature algorithms.
Implements ClientInterface.
Definition at line 70 of file WebTokenClient.php.
References WebTokenClient\SUPPORTED_ALGORITHMS.
| hasClaim | ( | $name | ) |
Check whether a JWT has a claim with the specified name.
| string | $name | Claim name |
Implements ClientInterface.
Definition at line 216 of file WebTokenClient.php.
| hasHeader | ( | $name | ) |
Check whether a JWT has a header with the specified name.
| string | $name | Header name |
Implements ClientInterface.
Definition at line 154 of file WebTokenClient.php.
| hasJwt | ( | ) |
Check if a JWT is defined.
Implements ClientInterface.
Definition at line 80 of file WebTokenClient.php.
| isEncrypted | ( | ) |
Check if a JWT's content is encrypted.
Implements ClientInterface.
Definition at line 90 of file WebTokenClient.php.
Referenced by WebTokenClient\getJweHeaders().
| load | ( | $jwtString, | |
$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) |
Implements ClientInterface.
Definition at line 103 of file WebTokenClient.php.
References Util\jsonDecode().
|
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) |
| Exception |
Implements ClientInterface.
Definition at line 348 of file WebTokenClient.php.
| verify | ( | $publicKey, | |
$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) |
Implements ClientInterface.
Definition at line 268 of file WebTokenClient.php.
| const SUPPORTED_ALGORITHMS = array('RS256', 'RS384', 'RS512') |
Supported signature algorithms.
Definition at line 28 of file WebTokenClient.php.
Referenced by WebTokenClient\getSupportedAlgorithms().