API Security in Depth · Authentication & Authorization for APIs
mTLS & Sender-Constrained Tokens (DPoP)
Binding credentials to a key so stolen tokens are useless.
Bearer tokens work for anyone who holds them. Sender-constrained tokens are bound to a key the client proves possession of:
- mTLS (RFC 8705): client certificate authenticates the client and access tokens are bound to the cert thumbprint (
cnf.x5t#S256). Common for B2B and in service meshes (SPIFFE identities). - DPoP (RFC 9449): the client signs a per-request proof JWT (method, URL, time, token hash) with its private key; tokens carry
cnf.jkt. Works at the application layer, including browsers and mobile. Financial-grade profiles (FAPI 2.0) require one of them.
Token binding options
| Criterion | Bearer | mTLS-bound (RFC 8705) | DPoP (RFC 9449) |
|---|---|---|---|
| Stolen token usable | Yes | No (needs client cert key) | No (needs private key) |
| Layer | — | TLS | HTTP (proof header) |
| Works through TLS-terminating proxies | Yes | Needs cert forwarding | Yes |
| Browser / mobile friendly | Yes | Hard | Yes |
| Replay protection | None | TLS session | jti + iat (+ server nonce) |
GET /v1/accounts HTTP/1.1
Host: api.bank.example
Authorization: DPoP eyJhbGciOiJFUzI1NiIs… # access token with cnf.jkt
DPoP: eyJ0eXAiOiJkcG9wK2p3dCIsImFsZyI6IkVTMjU2IiwiandrIjp7…}
# DPoP proof claims: {"htm":"GET","htu":"https://api.bank.example/v1/accounts","iat":1760170000,"jti":"…","ath":"<sha256 of access token>"}
apiVersion: security.istio.io/v1
kind: PeerAuthentication
metadata: { name: default, namespace: payments }
spec:
mtls: { mode: STRICT } # all service-to-service traffic must present mesh certs
Common pitfalls
- mTLS terminated at a load balancer and identity not forwarded securely.
- Accepting DPoP proofs without checking htm/htu/iat/jti.
- Assuming mesh mTLS replaces application authorization.
Key points
- Bind tokens to keys for high-value APIs
- mTLS for services and B2B
- DPoP for apps at the HTTP layer
Further reading: RFC 9449: OAuth 2.0 DPoP
Practice questions
What problem do sender-constrained tokens solve?
Answer
Token theft/replay: a stolen bearer token works for anyone, while a sender-constrained token also requires proof of the bound private key.
Does service-mesh mTLS mean services no longer need authorization?
Answer
No — mTLS proves which workload is calling, but each service must still check whether that caller (and end user) may perform the action.
Open in the app to mark lessons complete, take notes and track your progress.