Commit 11e4bed
feat(serveredition): per-user brokered-credential REST surfaces (spec 074 T8) (#692)
* feat(serveredition): per-user brokered-credential REST surfaces (spec 074, MCP-1041)
Add the T8 REST API for per-user upstream credentials (server edition),
mounted behind the session/JWT auth middleware:
- GET /api/v1/user/credentials list connection status +
non-secret metadata (connected/expired/not_connected/unavailable);
access/refresh tokens are NEVER serialized (FR-026).
- DELETE /api/v1/user/credentials/{server} disconnect/revoke the caller's
own credential.
- GET /api/v1/user/credentials/{server}/connect initiate Path B; builds
a PKCE authorize URL bound to the user and 302-redirects upstream.
- GET /api/v1/user/credentials/{server}/callback validates state, exchanges
the code, persists the per-user credential, redirects to the Web UI.
Every operation is scoped to the authenticated caller (FR-027): list/delete key
the store by the caller's userID, and the connect callback persists under the
*initiating* user (the connector binds state->userID), so a callback cannot
write into another user's record.
A connectorProvider caches one OAuthConnector (T5) per oauth_connect upstream so
the in-memory PKCE/state survives between the connect redirect and the callback,
and satisfies broker.ConnectorProvider so the T6 CredentialResolver can mint
connect URLs through the same connectors.
TDD: secret redaction, status mapping, store-disabled, delete-removes,
unknown-server 404, cross-user isolation, connect redirect, connect+callback
end-to-end credential persistence, denied callback, unauthenticated 401.
Docs: CLAUDE.md server API table + docs/features/idp-token-storage.md credentials
API section. swagger.yaml is generated from personal-edition swag annotations
(server-edition routes are build-tagged and not scanned), consistent with every
other /api/v1/user/* and /api/v1/auth/* server-edition endpoint.
Related spec 074, MCP-1041 (blocked-by T5/T6, now resolved).
* fix(docs): keep CLAUDE.md under 40k char limit (check-size)
The T8 server-API table addition pushed CLAUDE.md from 39,949 to 40,411
chars, tripping the claude-md-check (check-size) 40,000-char gate. The
credential endpoints are already fully documented in
docs/features/idp-token-storage.md (the canonical server-edition home), so
drop the redundant CLAUDE.md table rows rather than trim unrelated content.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
* refactor(docs): move credentials API docs out of #692 (PR-size split)
Maintainer fix-before-merge: PR #692 tripped the PR-size review gate at
~913 added lines. Remove the docs/features/idp-token-storage.md credentials
API section from this PR so it reduces to handlers + tests only (~852
lines). The docs land in a separate follow-up PR so they're not lost.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
* docs(serveredition): credentials REST API reference (spec 074 T8 follow-up)
Documents the per-user brokered-credential REST surfaces added in PR #692
(spec 074 T8): GET/DELETE /api/v1/user/credentials, the connection-status
model (no secrets, FR-026), and the Path B connect/callback flow.
Split out of #692 to keep that PR under the PR-size review gate; the code
landed there, this is the documentation follow-up.
Related spec 074, MCP-1041.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
---------
Co-authored-by: Paperclip <noreply@paperclip.ing>1 parent 3ab5b18 commit 11e4bed
5 files changed
Lines changed: 909 additions & 0 deletions
File tree
- docs/features
- internal/serveredition
- api
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
81 | 138 | | |
82 | 139 | | |
83 | 140 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
0 commit comments