T13.2: Okta Management API client (D18)
New server/okta_sync.py: lists every Okta user and status with its own read-only credential (OKTA_API_TOKEN, SSWS), separate from the OIDC client. Follows pagination. Every failure raises OktaSyncError; an error is never an empty list, because T13.3 reads an empty list as "nobody is active". Also refuses: a next-page link to another host (token never leaves the org), a redirect, a chain over 50 pages (a cut-off list looks like missing users), a bad item among good ones (never skipped), and an empty list. tests/okta_sync_check.py: 52 checks, self-contained (httpx MockTransport). Not wired into app.py yet. T13.3 uses it; T13.4 starts it on a schedule.
This commit is contained in:
@@ -105,13 +105,17 @@ unnecessarily.
|
||||
|
||||
**Done when:**
|
||||
|
||||
- [ ] the client authenticates with its own credential, distinct from the OIDC
|
||||
- [x] the client authenticates with its own credential, distinct from the OIDC
|
||||
client
|
||||
- [ ] it fetches the complete Okta user list, handling pagination
|
||||
- [ ] an auth failure or malformed response raises a clear, specific error
|
||||
*(2026-10-16: `OKTA_API_TOKEN`, sent as `Authorization: SSWS`. `tests/okta_sync_check.py` sets a different OIDC client secret and asserts it is never sent.)*
|
||||
- [x] it fetches the complete Okta user list, handling pagination
|
||||
*(2026-10-16: follows `Link: rel="next"`, 200 per page, 2-page case checked. A next link to another host is refused, a chain longer than 50 pages raises instead of cutting the list off, redirects are never followed.)*
|
||||
- [x] an auth failure or malformed response raises a clear, specific error
|
||||
rather than returning an empty list indistinguishable from "everyone was
|
||||
deprovisioned" — this distinction is what T13.3 depends on
|
||||
- [ ] the credential is never logged or surfaced in any API response
|
||||
*(2026-10-16: `OktaSyncError` for HTTP 401/403/404/429/5xx, redirects, network errors, timeouts, non-JSON, non-list, a bad item (never skipped), and an empty list. 31 failure checks. Mutation test: making the client return `[]` on an error fails 10 of them.)*
|
||||
- [x] the credential is never logged or surfaced in any API response
|
||||
*(2026-10-16: error messages carry the class name and HTTP status only, never the URL or a header. `describe()` has no token. Nothing is wired to an API response yet; T13.4 wires the startup log.)*
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user