RFC 9449 — OAuth 2.0 Demonstrating Proof-of-Possession at the Application Layer (DPoP)
Gap (candidate for L5 work)
Source: docs/oauth/RFC_9449.md
RFC 9449 — OAuth 2.0 Demonstrating Proof-of-Possession at the Application Layer (DPoP) ¶
Status: Standards Track
Published: 2023-09
L-tier / T-tier: L5 · T5 (issue) + T6 (present proof) + T7 (verify)
OneAuth coverage: Implemented — issuance (cnf.jkt, bound refresh tokens), resource-server enforcement,dpop_jktat/authorizeand on a pushed request, the §8/§9 nonce protocol, and client SDK proof minting with nonce retry
See also:RFC_8705.md·RFC_9068.md·LANDSCAPE.md
In one sentence ¶
DPoP binds an access token to a key the client itself generates — letting
public clients (browsers, mobile apps, CLIs without PKI) get the same
“useless if stolen” property as mTLS-bound tokens, without any PKI
infrastructure.
What problem does it solve? ¶
| Without DPoP | With DPoP |
|---|---|
| Public clients (browsers, mobile apps) can’t use mTLS-bound tokens — no TLS client cert | Client generates its own ephemeral keypair; proves possession via signed proof JWT |
| Bearer tokens leaked from a mobile app’s keychain are usable from anywhere | Stolen token without the matching private key is useless |
| FAPI 2.0 requires sender-constrained tokens, but PKI is impractical for consumer apps | DPoP gives FAPI-grade binding without PKI |
| Sender-binding for high-scale public APIs requires a separate proof per request anyway | DPoP makes that proof a tiny signed JWT in a header — cheap |
DPoP is the public-client answer to “how do we get sender-binding without
PKI?” It pairs naturally with PKCE — same threat model (public client, no
durable secret), same defense pattern (per-flow ephemeral key, proof of
possession).
DPoP is newer than mTLS (2023 vs 2020) and the design benefits — both as
a spec (nonce for replay defense built in) and as deployment ergonomics
(no PKI to manage).
Relatable example ¶
A mobile banking app that needs FAPI 2.0 compliance:
- On startup, the app generates an EC P-256 keypair in the keychain.
- When initiating OAuth, the app sends a DPoP proof JWT in a header:
DPoP: <signed-JWT-binding-to-this-key>. The AS issues an access token
withcnf.jkt= thumbprint of the app’s public key. - Every API call to the RS includes both the access token AND a fresh
DPoP proof JWT signed with the same key, bound to that specific
request’s method + URL. - RS verifies: token signature (via JWKS), proof signature (via key
embedded in proof header),cnf.jktmatches the proof key’s
thumbprint, request method+URL match the proof’s claim. - If anyone steals the access token, the proof can’t be forged without
the private key.
The public/private key never leaves the app. No PKI. No CA. Same sender-
constraint as mTLS.
Key concepts ¶
- The DPoP proof JWT is signed by a key the client controls. Its
header hastyp:"dpop+jwt", an embeddedjwk(the public key), and
alg. Its claims include:jti— unique per proof (replay defense)htm— HTTP method (e.g.,POST,GET)htu— HTTP target URI (e.g.,https://as.example.com/api/token)iat— issued at (timestamp)ath— (when binding to an access token) SHA-256 of the access tokennonce— (when server demanded one) AS-provided nonce echoed back
- Two binding points:
- At
/token: AS issues an access token withcnf.jkt= thumbprint
of the proof key (RFC 7638 thumbprint, per RFC 7517). - At the RS: every request carries a DPoP proof bound to (method, URL,
access-token hash); RS verifies the proof key matchescnf.jkt.
- At
- Nonce protocol (§8 + §9) for replay defense:
- AS or RS can respond
401 Unauthorizedwith
DPoP-Nonce: <value>andWWW-Authenticate: DPoP error="use_dpop_nonce"
when it wants a server-provided nonce in the next proof. - Client includes
nonceclaim in the next proof; server records and
enforces single-use. - Without nonce, the
jti-only defense is bounded by the server’s
clock-skew window.
- AS or RS can respond
- Token type changes from
BearertoDPoPin the Authorization
header:Authorization: DPoP <access-token>. RSes that don’t speak
DPoP would ignore it; RSes that do, validate the proof. - Discovery advertisement:
dpop_signing_alg_values_supportedin AS metadatadpop_bound_access_tokens_requiredin PR metadata (RFC 9728)
- Public clients ≠ unsigned clients. DPoP is the public-client
analogue ofprivate_key_jwt— both are asymmetric proof-of-possession,
but DPoP uses an ephemeral client-generated key rather than a registered
one.
Wire example ¶
At /token — client presents DPoP proof, AS issues token with cnf binding:
POST /api/token HTTP/1.1
Host: as.example.com
Content-Type: application/x-www-form-urlencoded
DPoP: eyJ0eXAiOiJkcG9wK2p3dCIsImFsZyI6IkVTMjU2IiwiandrIjp7Imt0eSI6IkVDIiwiY3J2IjoiUC0yNTYiLCJ4Ijoi...","eSI6Ii...".eyJqdGkiOiJodWQ4...","aHRtIjoiUE9TVCIsImh0dSI6Imh0dHBzOi8vYXMuZXhhbXBsZS5jb20vYXBpL3Rva2VuIiwiaWF0IjoxNzE3MDAwMDAwfQ.signature
grant_type=authorization_code
&code=Spl...
&code_verifier=dBj...
&client_id=public-mobile-app
Decoded DPoP proof JWT:
header : { "typ":"dpop+jwt", "alg":"ES256",
"jwk": { "kty":"EC", "crv":"P-256", "x":"...", "y":"..." } }
payload : { "jti":"hud8-tbd6-...", "htm":"POST", "htu":"https://as.example.com/api/token",
"iat":1717000000 }
HTTP/1.1 200 OK
Content-Type: application/json
{
"access_token": "eyJhbGciOi...",
"token_type": "DPoP",
"expires_in": 3600,
"scope": "read write"
}
Issued JWT includes:
{
"iss": "https://as.example.com", "sub": "user-42", ...,
"cnf": {
"jkt": "AaXf2WnsoFn7zCUcr3...thumbprint-of-proof-key"
}
}
At the RS — client includes a fresh DPoP proof bound to this request:
GET /api/me HTTP/1.1
Host: api.example.com
Authorization: DPoP eyJhbGciOi...
DPoP: eyJ0eXAiOiJkcG9wK2p3dCIsImFsZyI6IkVTMjU2IiwiandrIjp7...}.eyJqdGkiOiJyZG52aGstNDQyIiwiaHRtIjoiR0VUIiwiaHR1IjoiaHR0cHM6Ly9hcGkuZXhhbXBsZS5jb20vYXBpL21lIiwiaWF0IjoxNzE3MDAxMDAwLCJhdGgiOiJTLU0xanBzZ3o2Z3VTU3VkVTM..."}.signature
Decoded RS-side proof:
header : { "typ":"dpop+jwt", "alg":"ES256", "jwk": {...same as before} }
payload : { "jti":"rdnvhk-442", "htm":"GET", "htu":"https://api.example.com/api/me",
"iat":1717001000, "ath":"S-M1jpsgz6guSSudU3..." }
RS algorithm:
- Verify JWT signature on access token (via JWKS).
- Verify DPoP proof signature (via
jwkin proof header). - Compute thumbprint of
jwk; compare to access token’scnf.jkt.
Mismatch → reject. - Verify
htmmatches request method. - Verify
htumatches request URL. - Verify
athmatches SHA-256 of access token. - Check
jtiagainst replay store; record if first-seen.
Where it lands on the OAuth abstraction ¶
- L5 token sender constraint. DPoP is the public-client / no-PKI path.
- T5 (issue) + T6 (present proof on every request) + T7
(verify proof + cnf match). - Sibling spec: RFC 8705 mTLS — same property
(sender constraint) via TLS rather than app layer. Choose by deployment
topology.
OAuth 2.0 status ¶
Published 2023. Brand new in OAuth terms. Adoption climbing — Auth0 ships
DPoP support, Microsoft is adding it, FAPI 2.0 includes it as a peer to
mTLS. Not yet universal but the trajectory is clear.
OAuth 2.1 status ¶
Not mandated by 2.1. FAPI 2.0 (which builds on 2.1) requires one of mTLS or
DPoP. For non-FAPI 2.1 deployments, DPoP is optional but increasingly
recommended for public clients — RFC 9700 §4.10 names sender constraint
generally as a defense; DPoP is its public-client embodiment.
Migration path (bearer → DPoP-bound) ¶
Easier than mTLS — no PKI. The lift is at the wire-protocol level.
- Decide which surfaces use DPoP — most deployments enable for
public clients first (mobile apps, SPAs), keep confidential clients
onprivate_key_jwt. - Client SDK side: generate ephemeral keypair at startup; sign proof
JWTs per request; cache + replay-defendjti. - AS side: validate DPoP proof at
/token(proof signature,jti
uniqueness,htm/htumatch the request,iatwithin window); emit
cnf.jktclaim on issued tokens; changetoken_typefromBearer
toDPoP. - RS side: validate access token (as today) + DPoP proof on every
request (signature,jktmatch,htm/htumatch,athmatch,
jtireplay). - Nonce protocol is a Phase 2 — useful but not required out of
the gate. Without it,jti+ short window does the job.
Co-exist with Bearer tokens during the transition: AS issues both shapes
depending on whether the client sent a DPoP proof.
When NOT to use it ¶
- Server-to-server with PKI already in place — mTLS is the simpler
fit; you’re already running the cert plumbing. - High-throughput internal services on a trusted network — proof
generation is cheap but non-zero; if the network’s already controlled,
the marginal value may not justify the implementation cost. - Clients on resource-constrained hardware (some IoT) that can’t
reliably sign proofs per request.
OneAuth status ¶
| 9449 surface | Status | Where (grep-verified) | Notes |
|---|---|---|---|
DPoP proof JWT validation at /token |
Implemented | apiauth/dpop.go DPoPProofValidator |
typ, alg allow-list (default ES256, EdDSA, RS256, PS256; EdDSA means Ed25519 and is accepted by default since 0.1.43), embedded jwk (RSA keys of at least 2048 bits), signature, htm, htu (compared after RFC 3986 §6.2 normalization), iat window, jti replay (jti capped at 256 bytes) |
cnf.jkt claim emission on issued tokens |
Implemented | apiauth/token_validator.go (CreateAccessToken) |
Every grant: password, client_credentials, refresh, authorization_code, device_code, jwt-bearer, token-exchange |
token_type: "DPoP" in token response |
Implemented | CreateAccessTokenResponse.TokenType |
Reported by the issuer, not each call site, so a bound token can’t be advertised as Bearer |
| Refresh-token binding (§5) | Implemented | core.RefreshToken.Confirmation; FS / GORM / GAE stores, each with a round-trip test |
Rotation carries the binding forward; a bound token is unredeemable without its key. Only a public client’s refresh token is bound. A confidential client’s is constrained by its client authentication instead, as §5 says, so it can refresh with a new key and the new access token binds to that key (refreshConfirmation in apiauth/confidential_client_auth.go, issue 443) |
RS-side proof validation (every request: htm, htu, ath, jti) |
Implemented | DPoPProofValidator.ConfirmResource; wired via APIMiddleware.DPoP |
ath is required on the resource leg |
cnf.jkt thumbprint match at RS |
Implemented | APIMiddleware.enforceBinding |
Includes the §7.2 refusal of a bound token sent as Bearer |
Nonce protocol (DPoP-Nonce header), §8 + §9 |
Implemented | apiauth/dpop_nonce.go NonceSource; DPoPConfig.NoncePolicy decides which requests are challenged |
Off by default. Client retry in client/ keys nonces per origin, since §9 warns AS and RS nonces are distinct |
Authorization: DPoP <token> parsing |
Implemented | APIMiddleware.credentials |
Bearer and DPoP; any other scheme is refused |
dpop_jkt on the authorization request (§10) |
Implemented | AuthorizationRequest.DPoPJKT → core.AuthorizationCode.DPoPJKT; enforced in AuthorizationCodeGrant |
Front channel |
dpop_jkt or a DPoP header on a pushed request (§10.1) |
Implemented | PARHandler.resolveDPoPBinding (#337) |
Both forms accepted; a mismatch between them is rejected. The proof’s htu is checked against /par on EndpointURL’s origin, so MountAuthorize can share the token endpoint’s validator, and a nonce challenge gets use_dpop_nonce plus DPoP-Nonce |
Requiring DPoP at the AS (FAPI 2.0 §5.3.2.1; §5.2 dpop_bound_access_tokens) |
Implemented | OneAuthConfig.RequireDPoP (every client); core.AppRegistration.DPoPBoundAccessTokens, settable through DCR (one client); OneAuthConfig.FAPI2 sets RequireDPoP |
A request with no proof gets 400 invalid_dpop_proof, never a bearer token. The reference server’s dpop: block sets it with require: true (0.1.43) |
dpop_signing_alg_values_supported AS metadata |
Implemented | apiauth/as_metadata.go; fill from DPoPProofValidator.SigningAlgValuesSupported() |
Advertise only when a validator is wired |
dpop_bound_access_tokens_required PR metadata |
Implemented | ProtectedResourceMetadata; enforced by APIMiddleware.RequireDPoP |
Advertise only when the middleware enforces it |
cnf on introspection responses |
Implemented | IntrospectionResult.Cnf |
Lets an RS that validates by introspection enforce the same binding |
WWW-Authenticate: DPoP challenges |
Implemented | APIMiddleware.challenge |
Both schemes advertised; error rides the scheme the client used (§7.2) |
| Client-side proof minting | Implemented | client.DPoPKey (NewDPoPKey for ES256; NewEd25519DPoPKey / NewDPoPKeyFromEd25519 for EdDSA, 0.1.43) + client.WithDPoPKey |
Token requests (including the automatic refresh), resource requests (ath), and dpop_jkt on browser login. Since 0.1.42 LoginWithBrowser also sends a proof on the code exchange and answers its nonce challenge. A DPoP-Nonce on any response, not only a challenge, is used for the next request (§8.2). DPoPKey.ProofWithNonce (0.2.1) mints a proof with a given nonce for callers that set Authorization on their own transport |
SDK DCR dpop_bound_access_tokens (§5.2) |
Implemented | client.ClientRegistrationRequest.DPoPBoundAccessTokens / ClientRegistrationResponse.DPoPBoundAccessTokens |
Since 0.1.42 |
| Reference server | Implemented | cmd/oneauth-server dpop: block (profile or algs, require, require_at_resource, nonce) and jwt.disable_refresh_token_rotation |
Since 0.1.43. deploy-examples/fapi-dpop.yaml turns all of it on, with fapi2: true |
| Keycloak interop (issuance by a third party) | Implemented | tests/keycloak/dpop_interop_test.go (#371) |
Runs under make testkcl; Keycloak needs --features=dpop |
| Crypto primitive: RFC 7638 thumbprint | Implemented | utils/jwk_thumbprint.go — RSA, EC P-256 and Ed25519 (RFC 8037 OKP) |
Validated against the RFC 9449 Figure 2 / Figure 9 vector in apiauth/dpop_proof_test.go |
Wiring it up. DPoP is off until a validator is supplied, so an existing
deployment keeps issuing bearer tokens until it opts in:
validator := apiauth.NewDPoPProofValidator(apiauth.DPoPConfig{
EndpointURL: "https://as.example.com/api/token", // required behind a TLS-terminating proxy
})
oa := apiauth.NewOneAuth(apiauth.OneAuthConfig{ /* ... */ DPoP: validator })
Then advertise it: ASServerMetadata.DPoPSigningAlgValuesSupported = validator.SigningAlgValuesSupported().
A client opts in per request by sending a DPoP header; one that does not
still gets a bearer token from the same endpoint.
A resource server opts in the same way, with its own externally-visible base
URL:
mw := &apiauth.APIMiddleware{ /* ... */ }
mw.DPoP = apiauth.NewDPoPProofValidator(apiauth.DPoPConfig{
BaseURL: "https://rs.example.com", // htu is this plus each request path
})
mw.RequireDPoP = true // optional: refuse bearer presentations outright
With neither EndpointURL nor BaseURL set, the expected htu comes from the
request. Behind a TLS-terminating proxy that request is plain http while the
client signed https. List the proxy in DPoPConfig.TrustedProxies and its
X-Forwarded-Proto: https sets the scheme. The host still comes from the
request, so a proxy that rewrites it needs a pinned URL (issue 541).
RFC 9449 §7.2 expects a DPoP-unaware resource server to accept a bound token
as a bearer token. APIMiddleware reads a token’s cnf even with DPoP nil,
so it refuses a bound token instead, with 401 invalid_token: it can’t check
the proof, and accepting the token would let a stolen one through (issue 486).
Wire DPoP at a resource server before clients send it bound tokens.
Nonces are opt-in, and deliberately so. RFC 9449 §8 puts the decision of
when to demand one out of scope. Demanding one on every request costs every
client an extra round trip on first contact and breaks any client that has not
implemented the retry, which today is most of them. So OneAuth takes a policy
function rather than a flag:
oa := apiauth.NewOneAuth(apiauth.OneAuthConfig{ /* ... */
DPoP: apiauth.NewDPoPProofValidator(apiauth.DPoPConfig{
EndpointURL: "https://as.example.com/api/token",
NonceSource: apiauth.NewNonceSource(apiauth.NonceConfig{
// Share the secret across a fleet, or each node will
// reject its neighbours' nonces and clients will loop.
Secret: sharedSecret,
}),
NoncePolicy: func(r *http.Request) bool {
return strings.HasPrefix(r.URL.Path, "/high-value")
},
}),
})
A NonceSource with no policy demands nothing, so wiring one is safe on its
own. The client SDK answers a challenge automatically when a DPoPKey is
configured.
Requiring DPoP. A FAPI deployment sets RequireDPoP on both sides and
restricts the algorithms. OneAuthConfig.FAPI2 sets the AS side’s
RequireDPoP (and turns off refresh-token rotation) on its own; the
algorithm list and the resource server’s RequireDPoP are still set
separately:
validator := apiauth.NewDPoPProofValidator(apiauth.DPoPConfig{
EndpointURL: "https://as.example.com/api/token",
AllowedAlgs: apiauth.FAPIDPoPAlgs(), // ES256, EdDSA, PS256; RS256 is refused
})
oa := apiauth.NewOneAuth(apiauth.OneAuthConfig{ /* ... */ DPoP: validator, RequireDPoP: true })
To require it of some clients only, register them with
dpop_bound_access_tokens: true (DCR) or set
AppRegistration.DPoPBoundAccessTokens; the token endpoint looks the client
up in AppStore.
MountAuthorize hands the same validator to /par. That’s safe: the pushed
endpoint checks htu against its own path on EndpointURL’s origin.
The reference server does the same from configuration: a dpop: block with
profile: fapi, require and require_at_resource, plus
jwt.disable_refresh_token_rotation. deploy-examples/fapi-dpop.yaml sets
all of them along with fapi2: true.
The full requirement-by-requirement matrix is in
docs/SECURITY_AUDIT.md.
What is left.
- A
TokenBindingValidatorinterface (shared seam with mTLS) — deferred
on purpose until #335 makes the second shape visible, since an
interface with one implementation is a guess about the second. - mTLS as the second sender constraint (#335).
OneAuthConfig.FAPI2
already requires DPoP and turns on PAR-only/authorizeand the rest
of the FAPI 2.0 Security Profile together (seeFAPI.md), so DPoP is
the only sender constraint a FAPI deployment can use today.
Related RFCs ¶
- RFC 8705 mTLS — sibling sender-constraint mechanism (PKI-based)
- RFC 9068 — JWT AT profile;
cnf.jktis a recognized claim there - RFC 7517 / RFC 7638 — JWK thumbprint computation
- RFC 7800 —
cnfclaim semantics - RFC 9700 — §4.10 sender constraint defense
- FAPI 2.0 — requires either DPoP or mTLS
- OAuth 2.1 draft — mentions DPoP as the public-client sender-constraint option