T13.10: DPoP for the Okta Management API calls, auto-detected (D24)

This commit is contained in:
2026-10-16 17:10:19 -07:00
parent 83e77ec622
commit 1a3468effd
7 changed files with 490 additions and 40 deletions

View File

@@ -61,3 +61,36 @@ code is a short lower-case word.
**Not decided here:** how often the key is replaced. A key is registered on the Okta
app and has no expiry that this code checks.
## D24: DPoP for the Okta Management API calls
**Asked by:** Matt Mabrey, 2026-10-16. **Extends:** D23. **Task:** T13.10.
**Why:** The first live token request with the service-app key ended with
`error invalid_dpop_proof`. The Okta app requires DPoP (RFC 9449). With DPoP, every
request carries a signed proof from a key that only the caller holds, so a stolen
access token alone does not work. The choice was to ask the Okta admin to switch DPoP
off, or to build it. Matt chose to build it.
**Decision:**
- `OKTA_SYNC_DPOP` is `auto` (default), `on` or `off`. In auto mode the sync asks for a
plain Bearer token first. If Okta answers `invalid_dpop_proof`, the sync asks again with
DPoP. So one build works whether the Okta app requires DPoP or not.
- Each run makes its own throwaway EC P-256 key. It is held in memory only, never
stored, logged or configured. The public half goes in each proof header.
- Each request gets its own proof (ES256, `typ` dpop+jwt): `htm`, `htu` without the
query, a one-time `jti`, `iat`, the server's latest `nonce`, and on an API call `ath`
(a hash of the access token). The same key is used for the token request and the API
calls. A new client assertion is built for every token attempt.
- A nonce challenge is answered once per request, at the token endpoint and at the API.
The token request is tried at most 4 times.
- A DPoP-bound token is sent as `Authorization: DPoP <token>`. If the setting is `off`
and Okta returns a DPoP-bound token, the sync stops with a clear message.
**Rules from D18 and D23 that stay:** fail closed; the key, the assertions, the proofs and
the access token are never logged or put in an error message; an error carries the HTTP
status and Okta's short error code only. The SSWS token path is unchanged.
**Not verified:** this has been tested only against a fake Okta that follows the RFC. The
first run against the real tenant is the real test.