Documentation

CryptoJwt extends AutoService
in package

The "Crypto JWT" service supports a token format suitable for exchanging/transmitting with external consumers (e.g. web-browsers).

It integrates with the CryptoRegistry (which is a source of valid signing keys).

By default, tokens are signed and validated using any 'SIGN'ing keys (ie 'CIVICRM_SIGN_KEYS').

Tags
see
https://jwt.io/
service

crypto.jwt

Table of Contents

Properties

$registry  : CryptoRegistry

Methods

decode()  : array<string|int, mixed>
encode()  : string
getRegistry()  : CryptoRegistry
suiteToAlg()  : string

Properties

Methods

decode()

public decode(string $token[, string $keyTag = 'SIGN' ]) : array<string|int, mixed>
Parameters
$token : string

The JWT token.

$keyTag : string = 'SIGN'

Lookup valid keys from the CryptoRegistry using $keyTag.

Tags
throws
CryptoException
Return values
array<string|int, mixed>

List of validated JWT claims.

encode()

public encode(array<string|int, mixed> $payload[, string $keyIdOrTag = 'SIGN' ]) : string
Parameters
$payload : array<string|int, mixed>

List of JWT claims. See IANA link below.

$keyIdOrTag : string = 'SIGN'

Choose a valid key from the CryptoRegistry using $keyIdOrTag.

Tags
throws
CryptoException
see
https://www.iana.org/assignments/jwt/jwt.xhtml
Return values
string

suiteToAlg()

protected static suiteToAlg(string $suite) : string
Parameters
$suite : string

Ex: 'jwt-hs256', 'jwt-hs384'

Return values
string

Ex: 'HS256', 'HS384'


        
On this page

Search results