Connectum API Reference / @connectum/auth / JwtAuthInterceptorOptions
Interface: JwtAuthInterceptorOptions ​
Defined in: packages/auth/src/types.ts:226
JWT auth interceptor options
Properties ​
algorithms? ​
optionalalgorithms?:string[]
Defined in: packages/auth/src/types.ts:285
Allowed algorithms
audience? ​
optionalaudience?:string|string[]
Defined in: packages/auth/src/types.ts:283
Expected audience(s). Omit the option to skip the check. A present value must be a non-empty string or an array of non-empty strings; an empty string throws when the interceptor is created.
claimsMapping? ​
optionalclaimsMapping?:object
Defined in: packages/auth/src/types.ts:290
Mapping from JWT claims to AuthContext fields. Supports dot-notation paths (e.g., "realm_access.roles").
name? ​
optionalname?:string
roles? ​
optionalroles?:string
scopes? ​
optionalscopes?:string
subject? ​
optionalsubject?:string
issuer? ​
optionalissuer?:string|string[]
Defined in: packages/auth/src/types.ts:278
Expected issuer(s). Omit the option to skip the check. A present value must be a non-empty string or an array of non-empty strings; an empty string throws when the interceptor is created.
jwks? ​
optionaljwks?:JwksOptions
Defined in: packages/auth/src/types.ts:235
Refresh and timeout settings of the remote key set. Only valid together with jwksUri (setting it without one throws when the interceptor is created); an unknown name or a value out of range throws too. Omit it to keep jose's defaults: 30 s cooldown, 10 min cache age, 5 s request timeout.
jwksUri? ​
optionaljwksUri?:string
Defined in: packages/auth/src/types.ts:228
JWKS endpoint URL for remote key set
maxTokenAge? ​
optionalmaxTokenAge?:string|number
Defined in: packages/auth/src/types.ts:305
Maximum token age. Passed to jose jwtVerify options. Number (seconds) or string (e.g., "2h", "7d"). Omit the option to skip the check; 0, a negative or non-finite number, a blank string, a text jose cannot read ("1month") and a text jose reads as zero or negative ("0s", "-1h", "1h ago") throw when the interceptor is created.
propagatedClaims? ​
optionalpropagatedClaims?:string[]
Defined in: packages/auth/src/types.ts:336
Filter which claims are propagated in headers, as for createAuthInterceptor. When set, only the listed claim names are written to x-auth-claims (no header when none of them is in the token); when not set, every claim of the token is. Applies only with propagateHeaders. A value that is not an array of non-empty strings throws when the interceptor is created.
propagateHeaders? ​
optionalpropagateHeaders?:boolean
Defined in: packages/auth/src/types.ts:328
Propagate auth context as headers for downstream services. A subject, type, name or scope containing NUL, CR or LF is rejected with Unauthenticated (and never cached) while this is on. Text above U+00FF is written as utf-8'' plus percent-encoded UTF-8 (with x-auth-encoding: percent-utf8) and read back by the receiver. An identity that does not fit its header (subject over 512 characters, type over 128, name over 256, serialized roles, scopes or claims over 8192) is rejected too, instead of being cut or left out.
Default ​
falsepublicKey? ​
optionalpublicKey?:CryptoKey
Defined in: packages/auth/src/types.ts:273
Asymmetric public key for JWT signature verification.
Supported algorithms:
- RSA: RS256, RS384, RS512
- RSA-PSS: PS256, PS384, PS512
- EC (ECDSA): ES256, ES384, ES512
- EdDSA: Ed25519, Ed448
Import a PEM-encoded key via Web Crypto API:
Examples ​
RSA public key
const rsaKey = await crypto.subtle.importKey(
"spki",
pemToArrayBuffer(rsaPem),
{ name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" },
true,
["verify"],
);EC public key
const ecKey = await crypto.subtle.importKey(
"spki",
pemToArrayBuffer(ecPem),
{ name: "ECDSA", namedCurve: "P-256" },
true,
["verify"],
);See ​
requireExpiration? ​
optionalrequireExpiration?:boolean
Defined in: packages/auth/src/types.ts:313
Reject a token that has no exp (expiration time) claim. A signed token without exp never expires, so a leaked one stays valid until the signing key is rotated; RFC 9068 requires exp in JWT access tokens. Set false only for a trusted issuer that cannot add exp.
Default ​
truesecret? ​
optionalsecret?:string
Defined in: packages/auth/src/types.ts:237
HMAC symmetric secret (for HS256/HS384/HS512)
skipMethods? ​
optionalskipMethods?:string[]
Defined in: packages/auth/src/types.ts:318
Methods to skip authentication for. The catch-all "*" is refused (creation throws).
Default ​
[]