Class to implement the JWT interface using the Firebase JWT library from https://github.com/firebase/php-jwt. 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=null) |
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 Firebase JWT library from https://github.com/firebase/php-jwt.
Definition at line 18 of file FirebaseClient.php.
|
static |
Generate a new private key in PEM format.
string | $signatureMethod | Signature method |
Implements ClientInterface.
Definition at line 323 of file FirebaseClient.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 202 of file FirebaseClient.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 151 of file FirebaseClient.php.
getHeaders | ( | ) |
Get the value of the headers.
Implements ClientInterface.
Definition at line 167 of file FirebaseClient.php.
getJweHeaders | ( | ) |
Get the value of the JWE headers.
Implements ClientInterface.
Definition at line 126 of file FirebaseClient.php.
|
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 380 of file FirebaseClient.php.
|
static |
Get the value of the headers for the last signed JWT (before any encryption).
Implements ClientInterface.
Definition at line 177 of file FirebaseClient.php.
|
static |
Get the value of the payload for the last signed JWT (before any encryption).
Implements ClientInterface.
Definition at line 228 of file FirebaseClient.php.
getPayload | ( | ) |
Get the value of the payload.
Implements ClientInterface.
Definition at line 218 of file FirebaseClient.php.
|
static |
Get the public key for a private key.
string | $privateKey | Private key in PEM format |
Implements ClientInterface.
Definition at line 359 of file FirebaseClient.php.
|
static |
Return an array of supported signature algorithms.
Implements ClientInterface.
Definition at line 66 of file FirebaseClient.php.
References FirebaseClient\SUPPORTED_ALGORITHMS.
hasClaim | ( | $name | ) |
Check whether a JWT has a claim with the specified name.
string | $name | Claim name |
Implements ClientInterface.
Definition at line 189 of file FirebaseClient.php.
hasHeader | ( | $name | ) |
Check whether a JWT has a header with the specified name.
string | $name | Header name |
Implements ClientInterface.
Definition at line 138 of file FirebaseClient.php.
hasJwt | ( | ) |
Check if a JWT is defined.
Implements ClientInterface.
Definition at line 76 of file FirebaseClient.php.
isEncrypted | ( | ) |
Check if a JWT's content is encrypted.
Implements ClientInterface.
Definition at line 86 of file FirebaseClient.php.
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 99 of file FirebaseClient.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 300 of file FirebaseClient.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 241 of file FirebaseClient.php.
const SUPPORTED_ALGORITHMS = array('RS256', 'RS384', 'RS512') |
Supported signature algorithms.
Definition at line 24 of file FirebaseClient.php.
Referenced by FirebaseClient\getSupportedAlgorithms().