Skip to content

[P13] oauth: DPoP-bound tokens (RFC 9449, SEP-1932) - #358

Merged
jeanmatthieu merged 5 commits into
rel/1.0.0from
conformance/p13-dpop
Nov 25, 2026
Merged

jeanmatthieu merged 5 commits into
rel/1.0.0from
conformance/p13-dpop

Conversation

@jeanmatthieu

@jeanmatthieu jeanmatthieu commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor
Part P13 of P0–P35, merged into rel/1.0.0 in order (previous: P12 (#359) · next: P14 (#357))
Branch conformance/p13-dpop
Base conformance/p12-enterprise-auth (stacked: GitHub retargets this PR to rel/1.0.0 when the previous part merges)
Commits 0679427 oauth: DPoP-bound tokens (RFC 9449, SEP-1932)
7e18ecf oauth: review fixes
77f5f7d oauth: second-pass review fixes
9ec738e oauth: let the authorizer report a DPoP nonce retry
6cf0325 oauth: third-pass review fixes (DPoP)
Size 33 files, +2053 / -175

Summary

Adds opt-in DPoP (RFC 9449) to OAuthAuthorizer. With OAuthConfiguration.dpop set, every
token request carries an ES256 DPoP proof, a DPoP token is stored with the key's thumbprint
and presented as Authorization: DPoP <token> with a per-request proof that includes ath, and
use_dpop_nonce errors from the authorization server and the MCP server are retried once per
request with the server's nonce; that retry does not count against maxAuthorizationAttempts.
This covers POST requests; the GET (SSE) stream gets the same once-per-request exemption in P18 (#353).
A DPoP-Nonce in any MCP server response is stored for the origin the request went to, through
the new HTTPClientAuthorizer.didReceiveResponse(headers:for:). The key is any
DPoPSigningKey, including a Secure Enclave key. To sign the method and URL,
HTTPClientAuthorizer.authorizationHeader(for:) is replaced by authorizationHeaders(for:method:)
(breaking), which the transport applies after requestModifier. The fixture handles auth/dpop
and auth/dpop-nonce; the default-leg client baseline goes from 8 to 0 entries.

Motivation

  • SEP-1932 specifies DPoP-bound access tokens for MCP clients: proofs on token requests (RFC
    9449 §5), the DPoP scheme with ath on resource requests (§7), and server nonces (§8, §9).
  • Conformance: auth/dpop and auth/dpop-nonce were the last 8 client entries in
    conformance/baseline.yml. They are extension scenarios in the default leg and do not count
    toward a tier.
  • Neither reference SDK implements the client side; this goes beyond parity.

Parity with the Python and Go SDKs, as of their releases at the time (Python 2.3, Go 1.8):

Feature Python Go Swift before Swift after
DPoP (SEP-1932) metadata fields only one metadata field no proofs on token and MCP requests, AS and RS nonces, key-bound storage; auth/dpop and auth/dpop-nonce pass

Changes

DPoP signer and configuration

  • Sources/MCP/Base/Authorization/OAuthDPoP.swift (new):
    • DPoPSigningKey (public protocol: publicKey, signature(for:)), with conformances for
      P256.Signing.PrivateKey and, where CryptoKit is available,
      SecureEnclave.P256.Signing.PrivateKey.
    • OAuthConfiguration.DPoP: init(key:) for any DPoPSigningKey, init(privateKey:)
      defaulting to a new software key, keyThumbprint (RFC 7638). The key is stored internally
      and not exposed.
    • Internal DPoPProofSigner: compact JWS with header typ dpop+jwt, alg ES256, public
      jwk (EC P-256 x, y); claims jti (16 random bytes), htm, htu (scheme and host
      lowercased, no user information, query or fragment), iat, ath (base64url SHA-256 of
      the token) when a token is presented, nonce when one is stored. Nonces are keyed by
      server kind (authorization server or resource server) and origin (scheme, host, port),
      behind an NSLock.
  • Sources/MCP/Base/Authorization/OAuthConfiguration.swift: public var dpop: DPoP? and the
    dpop: initializer parameter.
  • Sources/MCP/Base/Authorization/OAuthModels.swift: PRM dpop_bound_access_tokens_required
    and AS dpop_signing_alg_values_supported decoded; OAuthAccessToken.keyThumbprint and
    isDPoPBound.
  • Sources/MCP/Base/Authorization/OAuthConstants.swift: use_dpop_nonce error code, DPoP
    token type.
  • Sources/MCP/Base/Authorization/OAuthErrors.swift: dpopRequired,
    dpopAlgorithmUnsupported(supported:).
  • Sources/MCP/Base/Transports/HTTPServer/HTTPServerTypes.swift: HTTPHeaderName.dpop,
    HTTPHeaderName.dpopNonce.

Token endpoint

  • Sources/MCP/Base/Authorization/OAuthTokenEndpointClient.swift: internal
    OAuthTokenRequesting.request(parameters:endpoint:authentication:dpop:session:). With a
    signer, the request carries a DPoP proof for POST to the token endpoint, and any
    DPoP-Nonce response header is stored for that origin. A 400 use_dpop_nonce with a nonce is
    retried once. token_type DPoP is accepted only when the request carried a proof; otherwise
    only Bearer is accepted, as before.

Authorizer

  • Sources/MCP/Base/Authorization/OAuthAuthorizer.swift:
    • HTTPClientAuthorizer.authorizationHeaders(for:method:) throws -> [String: String]
      replaces authorizationHeader(for:). OAuthAuthorizer returns Authorization: Bearer for
      a Bearer token; for a DPoP-bound token, Authorization: DPoP and a DPoP proof with ath.
      A DPoP-bound token whose thumbprint differs from the configured key's, or any DPoP-bound
      token when dpop is nil, is cleared from storage.
    • The signer is passed to the authorization code, refresh, client credentials and jwt-bearer
      token requests. The SEP-990 token exchange at the IdP carries no proof.
    • storeTokenResponse stores tokenType DPoP and keyThumbprint for a DPoP answer; a
      Bearer answer is stored and used as Bearer.
    • checkDPoPSupport, before registration and the grant: with dpop, an AS
      dpop_signing_alg_values_supported without ES256 throws dpopAlgorithmUnsupported;
      without dpop, PRM dpop_bound_access_tokens_required: true throws dpopRequired.
    • handleChallenge parses the Bearer challenge, else the DPoP one. With dpop, it stores
      the DPoP-Nonce for the MCP server's origin; a 401 DPoP challenge with
      error="use_dpop_nonce", a nonce, and a valid DPoP-bound token stored returns true
      without acquiring a new token.
  • Sources/MCP/Base/Authorization/OAuthWWWAuthenticateParser.swift: requirement
    parseChallenge(scheme:from:) with a default implementation; DefaultOAuthWWWAuthenticateParser
    generalized from Bearer to any scheme.

Transport

  • Sources/MCP/Base/Transports/HTTPClientTransport.swift: applyAuthorization(to:) runs after
    requestModifier for POST and the SSE GET, with the request's final URL and method. A thrown
    error becomes MCPError.internalError("Authorization flow failed: …"). The call sits before the
    #if os(Linux) branch, so both send paths use it. The resumption GET of a POST response stream
    (P1 ([P1] http: deliver related messages on the request's stream; resume client response streams #370)) uses it too.
  • A resource server's use_dpop_nonce challenge is retried once per
    request. Before it, such challenges counted against maxAuthorizationAttempts (3), so a server
    that kept asking for a new nonce got two retries. The transport detects the challenge with
    DefaultOAuthWWWAuthenticateParser (401, DPoP scheme, error="use_dpop_nonce"); a second
    one for the same request fails it with the mapped authentication error. The token endpoint
    already retried once.

Conformance fixture and baseline

  • conformance/everything-client/main.swift: case auth/dpop, auth/dpop-nonce:
    .authorizationCode, .none(clientID: ""), dpop: .init().
  • conformance/baseline.yml: the 8 client entries removed; client: [].

Docs and snippets

  • Examples/Snippets/Protocol/Authorization.swift: snippet auth-dpop.
  • docs/src/protocol.src.md: request step 2 describes the DPoP headers; new "DPoP" section. The
    accessTokenProvider, issuer-check and error paragraphs move ahead of "Enterprise-managed
    authorization" (text unchanged).
  • design/auth.md: protocol signature, transport order, dpop setting, 401 step 0, section
    "DPoP (RFC 9449, SEP-1932)", two rejected alternatives, open questions.
  • docs/src/migration.src.md: HTTPClientAuthorizer and OAuthWWWAuthenticateParsing rows and
    section; OAuthAuthorizationError now six new cases in the release; OAuthAccessToken.keyThumbprint;
    DPoP challenge parsing under behavior changes; new-features row.
  • docs/src/rough_edges.src.md: DPoP limits (ES256 only, nonces in successful responses).
  • docs/src/troubleshooting.src.md: rows for dpopRequired, dpopAlgorithmUnsupported, a
    repeated use_dpop_nonce, tokenResponseInvalid; a note on keys lost across relaunches.
  • ROADMAP.md: DPoP row in the implemented table; "Deferred" renamed "Planned", now tasks only,
    with the SEP-2663 scope for a later PR; default-leg baseline 25 / 0. rough_edges.src.md also
    lists the 2025-11-25 experimental tasks (SEP-1686) as not planned.
  • docs/*.md: regenerated by scripts/weave.swift.
  • CLAUDE.md: DPoP and the header order in the authorization paragraph.
  • Tests: MockTokenClient and two call sites in OAuthIssuerTests.swift and
    OAuthJWTBearerTests.swift adapted to the new signatures.

Review fixes

Nonces (OAuthAuthorizer.swift, HTTPClientTransport.swift)

  • The MCP server's DPoP-Nonce was read only in handleChallenge (401/403) and stored for the
    configured endpoint, while proofs look nonces up by the request's final URL; a nonce rotated in
    a 2xx response was never read. New HTTPClientAuthorizer.didReceiveResponse(headers:for:)
    (default: nothing). The transport calls it for every response, on both POST paths and for the
    GET stream, with the URL the request was sent to, before challenge handling. OAuthAuthorizer
    stores the nonce for that origin.
  • A use_dpop_nonce retry counted against maxAuthorizationAttempts. The nonce retry no longer
    counts; a second nonce challenge for the same request fails it. The authorizer says which retry
    is a nonce retry:
    handleChallenge(statusCode:headers:endpoint:operationKey:sentAuthorization:session:), new
    in this release, returns HTTPChallengeResult (retry, isDPoPNonceRetry). OAuthAuthorizer
    classifies with its own challengeParser; the default implementation keeps the transport's
    previous classification for custom authorizers.

Signing key (OAuthDPoP.swift)

  • OAuthConfiguration.DPoP exposed the private key as a public privateKey property and only
    took a software key. New public protocol DPoPSigningKey, conformed to by
    P256.Signing.PrivateKey and SecureEnclave.P256.Signing.PrivateKey; new init(key:). The
    key is now the internal key; privateKey is removed. init(privateKey:) stays.
  • htu kept user information (user:password@). It is now dropped; a URL without valid
    components throws invalidResourceURI instead of being used as is.

Token response (OAuthModels.swift, OAuthTokenEndpointClient.swift)

  • token_type was trimmed for the acceptance check but stored as received, so a padded DPoP
    answer was accepted and not stored as DPoP-bound. OAuthTokenResponse trims it when decoding;
    the endpoint client uses the decoded value.

Docs

  • docs/src/protocol.src.md, design/auth.md, docs/src/migration.src.md (new-features row),
    CLAUDE.md, the auth-dpop snippet comment: nonces from every response, the uncounted
    nonce retry, DPoPSigningKey and Secure Enclave keys, htu without user information.
    docs/src/rough_edges.src.md: the DPoP row lists only ES256; design/auth.md drops the
    open question on nonces in successful responses. docs/*.md regenerated.

Diagram

sequenceDiagram
    participant C as Client
    participant AZ as Authorization server
    participant RS as MCP server
    Note over C,AZ: discovery, AS must list ES256 if it lists DPoP algorithms
    C->>AZ: POST token with DPoP proof (htm POST, htu token endpoint, no ath)
    AZ-->>C: 400 use_dpop_nonce, DPoP-Nonce n1
    C->>AZ: POST token with a new proof, nonce n1
    AZ-->>C: 200 token_type DPoP
    Note over C: store token with tokenType DPoP and keyThumbprint
    C->>RS: POST with Authorization DPoP token and DPoP proof with ath
    RS-->>C: 401 DPoP challenge use_dpop_nonce, DPoP-Nonce n2
    Note over C: keep the token, store n2 for the RS origin
    C->>RS: POST with Authorization DPoP token and a new proof with ath and n2
    RS-->>C: 200
Loading

API changes

Added:

  • OAuthConfiguration.DPoP with init(key:), init(privateKey:), keyThumbprint

  • DPoPSigningKey (publicKey, signature(for:)), and conformances of
    P256.Signing.PrivateKey and, where CryptoKit is available,
    SecureEnclave.P256.Signing.PrivateKey

  • OAuthConfiguration.dpop, and the dpop: initializer parameter (defaulted, after
    assertionProvider:)

  • OAuthAccessToken.keyThumbprint, the keyThumbprint: initializer parameter (defaulted), and
    OAuthAccessToken.isDPoPBound

  • OAuthAuthorizationError.dpopRequired, OAuthAuthorizationError.dpopAlgorithmUnsupported(supported:)

  • HTTPHeaderName.dpop, HTTPHeaderName.dpopNonce

  • OAuthWWWAuthenticateParsing.parseChallenge(scheme:from:), with a default implementation;
    DefaultOAuthWWWAuthenticateParser.parseChallenge(scheme:from:)

  • HTTPClientAuthorizer.authorizationHeaders(for:method:), OAuthAuthorizer.authorizationHeaders(for:method:)

  • HTTPClientAuthorizer.didReceiveResponse(headers:for:), with a default implementation that
    does nothing; OAuthAuthorizer.didReceiveResponse(headers:for:)
    Changed:

  • breaking: custom HTTPClientAuthorizer conformances must implement
    authorizationHeaders(for:method:) throws -> [String: String]. Return
    ["Authorization": value] where the old method returned value, and [:] for nil.

  • breaking (source): OAuthAuthorizationError has two new cases.

  • OAuthAccessToken.tokenType can now be "DPoP". OAuthAccessToken has a new optional stored
    property; tokens encoded by the previous release decode with keyThumbprint == nil.

  • OAuthWWWAuthenticateParsing has a new requirement; the default implementation keeps
    existing conformances compiling.

  • HTTPClientAuthorizer has a new requirement, didReceiveResponse(headers:for:); the default
    implementation keeps existing conformances compiling.

Removed:

  • breaking: HTTPClientAuthorizer.authorizationHeader(for:) and
    OAuthAuthorizer.authorizationHeader(for:).

Behavior changes

  • breaking: the transport sets the authorizer's headers after requestModifier (before:
    before it). An Authorization header set by the modifier is replaced when the authorizer
    returns one. The authorizer receives the request's final URL and method, not the configured
    endpoint.
  • An error thrown by authorizationHeaders fails the request with
    MCPError.internalError("Authorization flow failed: …").
  • Without dpop: a DPoP challenge is read for resource_metadata, scope and error when
    the response has no Bearer challenge; a stored DPoP-bound token is discarded; a resource
    with dpop_bound_access_tokens_required: true fails with dpopRequired. Token endpoint
    behavior is unchanged.
  • With dpop: everything in Changes above. Tokens from accessTokenProvider are always Bearer.
  • Any authorizer: the transport passes every response's headers to didReceiveResponse with
    the request URL. A use_dpop_nonce challenge from the MCP server is retried once per request
    and does not count against maxAuthorizationAttempts; a second one for the same request fails
    the request once handleChallenge reports it as a nonce retry again, instead of being retried
    up to maxAuthorizationAttempts. An OAuthAuthorizer that answers use_dpop_nonce with a new
    token uses up an attempt.

Conformance

Leg (server / client baseline entries) Before After
--spec-version 2025-11-25 0 / 0 0 / 0
--spec-version 2026-07-28 0 / 0 0 / 0
default 25 / 8 25 / 0

Tier score: 100% for client and server at 2025-11-25 and 2026-07-28, unchanged.

Scenario Checks after
auth/dpop 12/12
auth/dpop-nonce 14/14

Baseline entries removed: auth/dpop:sep-1932-client-dpop-auth-scheme,
auth/dpop:sep-1932-client-fresh-proof, auth/dpop:sep-1932-client-token-request-proof,
auth/dpop-nonce:sep-1932-client-as-nonce, auth/dpop-nonce:sep-1932-client-dpop-auth-scheme,
auth/dpop-nonce:sep-1932-client-fresh-proof, auth/dpop-nonce:sep-1932-client-rs-nonce,
auth/dpop-nonce:sep-1932-client-token-request-proof. The remaining 25 server entries are the
tasks-* extension scenarios.

Tests

Tests/MCPTests/OAuthDPoPTests.swift (new, 25 tests):

  • DPoPProofTests: proof is an ES256 dpop+jwt signed by the key in its jwk header; new jti
    per proof, no ath on token request proofs; nonces per origin and per server kind; RFC 7638
    thumbprint; DPoP challenge parsed alongside Bearer.
  • DPoPAuthorizerTests: DPoP scheme with a proof for the request; stored token records the
    thumbprint; Bearer answer used as Bearer with no proof; token bound to another key discarded;
    DPoP-bound token discarded without dpop; resource use_dpop_nonce keeps the token and the
    next proof carries the nonce; use_dpop_nonce without a token acquires one; dpopRequired;
    dpopAlgorithmUnsupported.
  • DPoPTokenRequestTests: proof for POST to the token endpoint; use_dpop_nonce retried once
    with the nonce; a second use_dpop_nonce fails; a DPoP token for a request without a proof
    is invalid.
  • DPoPTransportTests: headers set after requestModifier, for the final URL and method; a
    resource server's use_dpop_nonce is retried once per request (an authorizer that accepts
    every challenge, maxAuthorizationAttempts 5, a server that always answers with a new nonce:
    two requests, then an error).
  • Review fixes:
    • DPoPProofTests: htu drops user information; a custom DPoPSigningKey signs the proof
      and gives the thumbprint.
    • DPoPAuthorizerTests: a nonce passed to didReceiveResponse is used for the request URL's
      origin only; a padded token_type (" DPoP\n") is decoded as DPoP and stored DPoP-bound.
    • DPoPTransportTests: the second nonce challenge fails the request after the authorizer sees it,
      and every response reaches didReceiveResponse; with maxAuthorizationAttempts 2, a nonce
      challenge followed by an invalid_token challenge still succeeds.

Examples/Tests/ProtocolSnippetTests.swift: dpopConfigurationSignsProofs.

860 swift-testing tests pass, plus XCTest.

Review notes

  • Opt-in only. DPoP is not enabled from metadata alone: the key must be persisted with the
    tokens, which only the application can do (rejected alternative in design/auth.md). The
    default DPoP() key lives as long as the configuration.
  • Downgrade: with dpop, a Bearer answer from the token endpoint is accepted and used as
    Bearer. The client does not refuse it, even when the resource metadata sets
    dpop_bound_access_tokens_required.
  • Key binding: authorizationHeaders clears a DPoP-bound token whose keyThumbprint differs
    from the configured key's. Tokens saved by the previous release (Bearer, no thumbprint) keep
    working as Bearer.
  • Nonce retries: once per request on both sides. The token endpoint counts in its own loop
    (retriedWithNonce); for the MCP server, OAuthAuthorizer is shared by concurrent requests
    and operationKey is only the JSON-RPC method, so the per-request count lives in the
    transport's retry loop. The nonce retry does not count against maxAuthorizationAttempts
    (3).
  • Nonces from 2xx responses: the token endpoint client stores DPoP-Nonce from any response,
    including 200. On the MCP server side, didReceiveResponse stores it from every response, for
    the origin of the URL the request was sent to (after requestModifier), so a nonce rotated in
    a successful response (RFC 9449 §8.2) is used by the next request.
  • Algorithms: ES256 only. An AS that does not publish dpop_signing_alg_values_supported is
    used with ES256; one that publishes a list without ES256 fails with dpopAlgorithmUnsupported.
  • htu drops user information, query and fragment and lowercases scheme and host. The signature
    is the raw r‖s form, as for private_key_jwt.
  • The SEP-990 IdP token exchange sends no proof: it returns an assertion, not an access token.
  • authorizationHeaders stays synchronous; making OAuthAuthorizer an actor would make it
    async (open question in design/auth.md).
  • The commit also carries unrelated planning text: ROADMAP.md "Planned" section with the tasks
    (SEP-2663) scope, and the SEP-1686 row in rough_edges.md.
  • DPoPTokenRequestTests and DPoPTransportTests are compiled only under
    #if swift(>=6.1) && !os(Linux). Linux not verified.

Verification

Every branch of the stack builds and passes swift test; on this branch, 853 swift-testing
tests plus XCTest. DocC builds with --warnings-as-errors. All conformance legs pass at their
baselines; the tier score is 100% for client and server at 2025-11-25 and 2026-07-28.

git diff --shortstat conformance/p12-enterprise-auth..conformance/p13-dpop
swift build
swift test
swift test --filter 'DPoP'

BIN="$(swift build --show-bin-path)"
"$BIN/HelloClient" "$BIN/HelloServer"
swift package generate-documentation --target MCP --warnings-as-errors
swift scripts/weave.swift --check

export npm_config_registry=https://registry.npmjs.org
scripts/run-conformance.sh --bin-path "$BIN"
scripts/run-conformance.sh --spec-version 2025-11-25 --bin-path "$BIN"
scripts/run-conformance.sh --spec-version 2026-07-28 --bin-path "$BIN"
scripts/run-conformance.sh --requirements 2025-11-25 --bin-path "$BIN"
scripts/run-conformance.sh --requirements 2026-07-28 --bin-path "$BIN"

AI usage disclosure: the changes, the tests, the commit messages and this description were written with Claude Opus 5.5 and reviewed by the authors.

Adds opt-in DPoP (RFC 9449) to `OAuthAuthorizer`. With
`OAuthConfiguration.dpop` set, every token request carries an ES256 DPoP
proof, a `DPoP` token is stored with the key's thumbprint and presented
as `Authorization: DPoP <token>` with a per-request proof that includes
`ath`, and `use_dpop_nonce` errors from the authorization server and the
MCP server are retried once per request with the server's nonce; that
retry does not count against `maxAuthorizationAttempts`. A `DPoP-Nonce`
in any MCP server response is stored for the origin the request went to,
through the new `HTTPClientAuthorizer.didReceiveResponse(headers:for:)`.
The key is any `DPoPSigningKey`, including a Secure Enclave key. To sign
the method and URL, `HTTPClientAuthorizer.authorizationHeader(for:)` is
replaced by `authorizationHeaders(for:method:)` (breaking), which the
transport applies after `requestModifier`. The fixture handles
`auth/dpop` and `auth/dpop-nonce`; the default-leg client baseline goes
from 8 to 0 entries.
- Treat a resource server's use_dpop_nonce as the free nonce retry
  only when the 401 carries a DPoP-Nonce header (RFC 9449 section 9).
  Without it the authorizer runs a full challenge flow, which now
  counts against maxAuthorizationAttempts.
- authorizationHeaders discards a stored token for another
  authorization server or another DPoP key only if storage still
  holds that token, so a token a concurrent challenge saved after the
  load is kept.
- Document that DPoPSigningKey signs synchronously for every MCP and
  token request while the transport waits, so a key behind a network
  call slows every request.
- After a refresh, the stored token keeps the previous refresh token when
  the response has none (RFC 6749 section 6), so a later 401 can refresh
  again instead of clearing the tokens and starting a new grant. When
  neither the refresh request nor the response names a scope, the token
  keeps the scopes granted before (section 6); when the request named
  one, an omitted response scope still means the requested one (section
  5.1).
HTTPClientTransport decided by itself whether a 401 was a DPoP
use_dpop_nonce challenge (RFC 9449 §9), the one retry per request that
does not count against maxAuthorizationAttempts. It read the challenge
with a fresh DefaultOAuthWWWAuthenticateParser, while OAuthAuthorizer
reads it with its injected challengeParser, so with a custom parser the
two could disagree.

The HTTPClientAuthorizer requirement
handleChallenge(statusCode:headers:endpoint:operationKey:sentAuthorization:session:),
new in this release, now returns HTTPChallengeResult: whether to retry,
and whether the retry is a DPoP nonce retry. Its default calls the Bool
handleChallenge (unchanged since 0.12) and classifies the challenge with
the default parser as the transport did, so custom authorizers keep
their behaviour. OAuthAuthorizer reports the nonce retry it already
detects with its challengeParser: a valid DPoP-bound token and a nonce.
A use_dpop_nonce it answers with a new token is an ordinary attempt.

The transport asks the authorizer first, so it now also calls it for a
second nonce challenge before failing the request. The GET stream keeps
counting every challenge through an internal Bool overload until it gets
the nonce exemption.
- Of a Bearer and a DPoP challenge in one WWW-Authenticate, the
  authorizer answers the one for the scheme the request used, read from
  sentAuthorization (the stored token for the Bool method). RFC 9449
  section 7.2: a resource that offers both schemes puts the error in the
  challenge of the mechanism the client used, so a DPoP token's 403
  insufficient_scope carried in the DPoP challenge was read from the bare
  Bearer one and not stepped up. A resource_metadata missing from the
  answered challenge is taken from the other (RFC 9728 section 5.1).
- authorizationHeaders discards a token bound to another DPoP key, or a
  DPoP token without DPoP, before the expiry check, so an expired one is
  cleared too, and a refresh never uses the refresh token of such a token:
  RFC 9449 section 5 has a public client present a proof of the key the
  refresh token was obtained with. The refresh guard covers
  prepareAuthorization, which runs before authorizationHeaders.
- A use_dpop_nonce challenge is a nonce retry only while the stored DPoP
  token is bound to the configured key.
- Tests: a DPoP token refresh keeps the key binding and sends a proof of
  that key; the refresh that keeps the previous refresh token also keeps
  the previously granted, non-empty scopes.
canarik
canarik previously approved these changes Nov 25, 2026

@canarik canarik left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @jeanmatthieu

Base automatically changed from conformance/p12-enterprise-auth to rel/1.0.0 November 25, 2026 12:40
@jeanmatthieu
jeanmatthieu dismissed canarik’s stale review November 25, 2026 12:40

The base branch was changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants