LTI Integration Library 4.10.3
PHP class library for building LTI integrations
 
Loading...
Searching...
No Matches
ClientInterface Interface Reference

Interface to represent an HWT client. More...

Inheritance diagram for ClientInterface:
FirebaseClient SpomkyLabsClient WebTokenClient

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.
 

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.
 

Detailed Description

Interface to represent an HWT client.

Author
Stephen P Vickers steph.nosp@m.en@s.nosp@m.pvsof.nosp@m.twar.nosp@m.eprod.nosp@m.ucts.nosp@m..com
Licence: GNU Lesser General Public License, version 3 (<http://www.gnu.org/licenses/lgpl.html>)

Definition at line 12 of file Jwt/ClientInterface.php.

Member Function Documentation

◆ generateKey()

static generateKey (   $signatureMethod = 'RS256')
static

Generate a new private key in PEM format.

Parameters
string$signatureMethodSignature method
Returns
string|null Key in PEM format

Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.

◆ getClaim()

getClaim (   $name,
  $defaultValue = null 
)

Get the value of the claim with the specified name.

Parameters
string$nameClaim name
int | string | bool | array | object | null$defaultValueDefault value
Returns
int|string|bool|array|object|null The value of the claim with the specified name, or the default value if it does not exist

Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.

◆ getHeader()

getHeader (   $name,
  $defaultValue = null 
)

Get the value of the header with the specified name.

Parameters
string$nameHeader name
string | null$defaultValueDefault value
Returns
string|null The value of the header with the specified name, or the default value if it does not exist

Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.

◆ getHeaders()

getHeaders ( )

Get the value of the headers.

Returns
array The value of the headers

Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.

◆ getJweHeaders()

getJweHeaders ( )

Get the value of the JWE headers.

Returns
array The value of the JWE headers

Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.

◆ getJWKS()

static getJWKS (   $pemKey,
  $signatureMethod,
  $kid 
)
static

Get the public JWKS from a key in PEM format.

Parameters
string$pemKeyPrivate or public key in PEM format
string$signatureMethodSignature method
string | null$kidKey ID (optional)
Returns
array JWKS keys

Implemented in SpomkyLabsClient, WebTokenClient, and FirebaseClient.

◆ getLastHeaders()

static getLastHeaders ( )
static

Get the value of the headers for the last signed JWT (before any encryption).

Returns
array The value of the headers

Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.

◆ getLastPayload()

static getLastPayload ( )
static

Get the value of the payload for the last signed JWT (before any encryption).

Returns
array The value of the payload

Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.

◆ getPayload()

getPayload ( )

Get the value of the payload.

Returns
array The value of the payload

Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.

◆ getPublicKey()

static getPublicKey (   $privateKey)
static

Get the public key for a private key.

Parameters
string$privateKeyPrivate key in PEM format
Returns
string|null Public key in PEM format

Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.

◆ getSupportedAlgorithms()

static getSupportedAlgorithms ( )
static

Return an array of supported signature algorithms.

Returns
string[] Array of algorithm names

Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.

◆ hasClaim()

hasClaim (   $name)

Check whether a JWT has a claim with the specified name.

Parameters
string$nameClaim name
Returns
bool True if the JWT has a claim of the specified name

Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.

◆ hasHeader()

hasHeader (   $name)

Check whether a JWT has a header with the specified name.

Parameters
string$nameHeader name
Returns
bool True if the JWT has a header of the specified name

Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.

◆ hasJwt()

hasJwt ( )

Check if a JWT is defined.

Returns
bool True if a JWT is defined

Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.

◆ isEncrypted()

isEncrypted ( )

Check if a JWT's content is encrypted.

Returns
bool True if a JWT is encrypted

Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.

◆ load()

load (   $jwtString,
  $privateKey = null 
)

Load a JWT from a string.

Parameters
string$jwtStringJWT string
string | null$privateKeyPrivate key in PEM format for decrypting encrypted tokens (optional)
Returns
bool True if the JWT was successfully loaded

Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.

◆ sign()

static sign (   $payload,
  $signatureMethod,
  $privateKey,
  $kid = null,
  $jku = null,
  $encryptionMethod = null,
  $publicKey = null 
)
static

Sign the JWT.

Parameters
array$payloadPayload
string$signatureMethodSignature method
string$privateKeyPrivate key in PEM format
string | null$kidKey ID (optional)
string | null$jkuJSON Web Key URL (optional)
string | null$encryptionMethodEncryption method (optional)
string | null$publicKeyPublic key of recipient for content encryption (optional)
Returns
string Signed JWT

Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.

◆ verify()

verify (   $publicKey,
  $jku = null 
)

Verify the signature of the JWT.

Parameters
string | null$publicKeyPublic key of issuer
string | null$jkuJSON Web Key URL of issuer (optional)
Returns
bool True if the JWT has a valid signature

Implemented in FirebaseClient, SpomkyLabsClient, and WebTokenClient.


The documentation for this interface was generated from the following file: