Optional enabledEnables validation of certificate-bound (cnf.x5t#S256) access tokens.
mTLS is opt-in. The Express auth() middleware sets this to true
automatically when a getCertificate resolver is supplied, unless you
set it explicitly.
false
Optional requiredRequires every access token to be certificate-bound. When true, a token
without a valid cnf.x5t#S256 binding is rejected.
Scoped to the mTLS path: when DPoP is also enabled, DPoP is evaluated first, so a DPoP-bound token is handled by the DPoP path and this requirement is not applied to it.
Requires enabled: true to also be set explicitly; mTLS being opt-in
means it cannot be turned on implicitly just by requiring it.
false
Options that control mutual-TLS certificate-bound access token validation (RFC 8705 ยง3).
Remarks
When a client authenticates to the authorization server with a TLS client certificate, the issued access token carries a
cnf.x5t#S256claim: the base64url-encoded SHA-256 thumbprint of that certificate. This SDK validates, on each request, that the certificate presented on the TLS connection matches the thumbprint in the token.Because APIs commonly run behind a TLS-terminating proxy (nginx, ALB, Cloudflare, etc.), the SDK cannot read the TLS socket directly. The client certificate must be supplied by the caller โ see
getCertificateon the Expressauth()middleware โ and is then passed to this verifier as raw PEM or DER.mTLS is opt-in: unlike DPoP, it depends on a certificate resolver the caller must supply (see
getCertificateon the Expressauth()middleware), so it cannot safely default to on. The Express middleware enables it automatically whengetCertificateis supplied, unlessenabledis set explicitly.Behavior matrix:
Default (
{ enabled: false }): Thecnf.x5t#S256claim is ignored and no certificate binding is checked.Enabled (
{ enabled: true, required: false }): Validates the certificate binding when the token carriescnf.x5t#S256; plain bearer tokens are accepted as-is.Required (
{ enabled: true, required: true }): Every access token must be certificate-bound; a token without a validcnf.x5t#S256binding is rejected.Misconfiguration (
{ required: true }withoutenabled: true): Invalid โ a binding cannot be required unless mTLS is explicitly enabled.Interaction with DPoP: A token carries at most one confirmation method, so mTLS and DPoP are mutually exclusive per token. When both are enabled, DPoP is evaluated first and takes precedence: the mTLS verifier runs only for requests the DPoP path does not handle. As a result
required: trueis scoped to the mTLS path (it does not force a certificate binding on a request satisfied by a DPoP-bound token), and enablingdpop.requiredmakes these options inert because every request is then routed to the DPoP path.See
https://www.rfc-editor.org/rfc/rfc8705