Skip to content

Interface: HttpJwtAuth ​

A JSON Web Token the host signs for each request: the claims in payload, under secret (HS256, HS384, HS512) or the PEM privateKey (RS* and PS*, an RSA key of 2048 bits or more; ES*, a key on the algorithm's curve), with jwtHeaders beside alg in its header. Sent as authorization: <headerPrefix><token>, or as the query parameter paramName.

Properties ​

addTo? ​

ts
optional addTo?: HttpAuthAddTo;

algorithm? ​

ts
optional algorithm?: HttpJwtAlgorithm;

HS256 by default.


authType ​

ts
authType: "jwt";

headerPrefix? ​

ts
optional headerPrefix?: string;

By default Bearer and a space.


isSecretBase64Encoded? ​

ts
optional isSecretBase64Encoded?: boolean;

secret is base64 text, decoded to the key's bytes.


jwtHeaders? ​

ts
optional jwtHeaders?: Record<string, unknown>;

Header parameters besides alg (kid, typ...).


paramName? ​

ts
optional paramName?: string;

token by default.


payload? ​

ts
optional payload?: Record<string, unknown>;

The claims, as given: the host adds none. iat, nbf and exp may be text relative to the signing time, 'now', '5m' or '-30s' (seconds, minutes, hours or days).


privateKey? ​

ts
optional privateKey?: string;

The PEM private key, for RS*, PS* and ES*: ctx.secret(name).


secret? ​

ts
optional secret?: string;

The HMAC secret, for HS*: ctx.secret(name).

Released under the Apache-2.0 License.