Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -1445,4 +1445,4 @@ Legend: `shipped` ≥95% checked · `in-flight` 1–94% · `drafted` 0% · `—`
| [129-per-user-upstream-credentials](./specs/129-per-user-upstream-credentials/) | — | — |
| [130-skills-review-ux](./specs/130-skills-review-ux/) | `shipped` | 9/9 (100%) |
| [131-skills-card-ux](./specs/131-skills-card-ux/) | `shipped` | 7/7 (100%) |
| [132-client-oauth-login](./specs/132-client-oauth-login/) | `drafted` | 0/72 (0%) |
| [132-client-oauth-login](./specs/132-client-oauth-login/) | `in-flight` | 8/72 (11%) |
9 changes: 5 additions & 4 deletions specs/132-client-oauth-login/contracts/rest-admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ Pending requests, newest first: `[{id, client_label, created_at, expires_at}]`.
"suggested_client": { "id": "cursor", "matched": "display_name" }, // generic only; present when the reported name equals exactly one entry of existing_clients (matched: id | display_name | known_name); absent otherwise
"profiles": [ { "name": "dev-readonly" } ],
"profile_required": true, // profiles exist and the client has no binding
"previous_login": { "grant_id": "…", "approved_at": "…" }, // same registration signed in before
"previous_login": { "grant_id": "…", "client_id": "cursor", "approved_at": "…" }, // same registration signed in before: its newest live login
"previous_logins": [ { "grant_id": "…", "client_id": "cursor", "approved_at": "…" } ], // newest live login of this registration under each client (a per-client address lists only that client)
"guard": null // only when the address fixes a client that has a binding; else absent, use preview
}
```

`404` for an unknown, expired, decided or cancelled id (one uniform answer).

`suggested_client` is advice for the page only. It is computed on read from the sanitised reported name (trimmed, compared without regard to case) against each entry of `existing_clients`: its id, its display name and, for a connect-registry client, its known client names. The whole name is tried and, when it ends with a parenthesised suffix, also the part before it. Matches are collected over all fields and counted by distinct client id; exactly one distinct client → present, none or several → absent. `matched` names the first field that matched in the order `id`, `display_name`, `known_name`. Preview and approve take the client from their own body and never fall back to the suggestion: on the generic address, preview without a client answers `200 {"complete": false}` with no `access` and no `guard`, and approve without a client answers `422 client_required`.
`suggested_client` is advice for the page only. It is computed on read from the sanitised reported name (trimmed, compared without regard to case) against each entry of `existing_clients`: its id, its display name and, for a connect-registry client, its known client names. The whole name is tried and, when it ends with a parenthesised suffix, also the part before it. Matches are collected over all fields and counted by distinct client id; exactly one distinct client → present, none or several → absent. `matched` names the first field that matched in the order `id`, `display_name`, `known_name`. The reported name and a new client's display name are stored without Unicode format characters (category Cf: bidi controls, zero-width characters), and so is the name observed at `initialize`; the page shows every such name in an isolated element. Preview and approve take the client from their own body and never fall back to the suggestion: on the generic address, preview without a client answers `200 {"complete": false}` with no `access` and no `guard`, and approve without a client answers `422 client_required`.

### `POST /oauth/authorizations/{id}/preview`

Expand All @@ -61,15 +62,15 @@ Records the decision and issues the code. The login itself is stored when the cl
"profile": "dev-readonly", // "" = All servers; ignored when the client has a binding
"mode": "locked",
"binding_revision": "b1f3…", // required when the client has a binding
"replace_grant": "…" // optional: the previous_login grant id
"replace_grant": "…" // optional: the grant id of the previous login under the chosen client (previous_logins)
}
```

- `200 {redirect_url}`: the page navigates there.
- `409 already_decided`.
- `409 binding_changed`: the binding differs from `binding_revision`; reload.
- `409 binding_bypassable_without_auth`: body as the existing guard refusal.
- `422 client_required` (generic address, no client in the body), `422 profile_required`, `422 client_fixed` (a client other than the one in the address), `422 identity_exists` / `reserved_identity` for a new client id, `404 profile_not_found`.
- `422 client_required` (generic address, no client in the body), `422 profile_required`, `422 client_fixed` (a client other than the one in the address), `422 identity_exists` / `reserved_identity` for a new client id, `422 invalid_replace_grant` (a live login of this registration that belongs to another client; a grant of another registration is ignored), `404 profile_not_found`, `404 client_not_found` (the chosen client no longer exists; the request itself is still pending).

### `POST /oauth/authorizations/{id}/deny`

Expand Down
16 changes: 8 additions & 8 deletions specs/132-client-oauth-login/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ Tasks are grouped by the three delivery PRs. Each PR is merged before the next s

### Phase 9: Consent page (US2, US5, US4)

- [ ] T047 [P] [US2] Add API methods and types for authorizations and client credentials in `frontend/src/services/api.ts` and `frontend/src/types/`
- [ ] T048 [US2] Vitest `frontend/tests/unit/authorize-request.spec.ts`: fixed client view, unverified-name label, access sentence, profile shown not asked when bound, Approve disabled until a profile is chosen when `profile_required`, replace-login checkbox only with `previous_login`, guard verdict fetched through the preview call whenever the selection is complete or changes, refusal with fixes shown and Approve disabled until it is clean, `already_decided` and `binding_changed` handling, navigation to `redirect_url`
- [ ] T049 [US2] Implement `frontend/src/views/AuthorizeRequest.vue` and the `/authorize` route in `frontend/src/router/index.ts`, reusing `GuardRefusal.vue`, `ProfileChip.vue`
- [ ] T049a [US5] Tests then code: `suggested_client` on the sign-in request payload (`internal/runtime/oauth_login_consent.go`, `internal/httpapi/oauth_login.go`, `internal/contracts`, `make swagger`): exactly one case-insensitive match on id, display name or known client name → present with `matched`; none or several → absent; one client matching on several fields is one match (`matched` precedence `id`, `display_name`, `known_name`); a name equal to one client's id and another's display name → absent; a trailing parenthesised suffix is also tried without it; never on a per-client address; with a suggestion present, preview without a client answers `200 {complete:false}` with no access and no guard, and approve without a client answers `422 client_required` and writes nothing
- [ ] T050 [US5] Vitest in `frontend/tests/unit/authorize-request.spec.ts` for the generic address: "New client" selected when there is no `suggested_client`, the suggested client selected with the unverified-name notice when there is one, changing the selection sends the changed client, "New client" with editable id and name, existing-client choice shows the access sentence, `identity_exists` / `reserved_identity` errors
- [ ] T051 [US5] Implement the generic-address branch in `frontend/src/views/AuthorizeRequest.vue`
- [ ] T052 [US4] Vitest then code: with no API key in storage `AuthorizeRequest.vue` shows only "Open from the tray or paste the API key", makes no request-detail call, and continues after a pasted key (`frontend/tests/unit/authorize-request-nokey.spec.ts`)
- [ ] T053 [US4] Test then code: `frame-ancestors 'none'` (and `X-Frame-Options: DENY`) on `/ui/authorize` in `internal/server/server.go` (`internal/server/oauth_login_http_test.go`)
- [x] T047 [P] [US2] Add API methods and types for authorizations and client credentials in `frontend/src/services/api.ts` and `frontend/src/types/`
- [x] T048 [US2] Vitest `frontend/tests/unit/authorize-request.spec.ts`: fixed client view, unverified-name label, access sentence, profile shown not asked when bound, Approve disabled until a profile is chosen when `profile_required`, replace-login checkbox only with `previous_login`, guard verdict fetched through the preview call whenever the selection is complete or changes, refusal with fixes shown and Approve disabled until it is clean, `already_decided` and `binding_changed` handling, navigation to `redirect_url`
- [x] T049 [US2] Implement `frontend/src/views/AuthorizeRequest.vue` and the `/authorize` route in `frontend/src/router/index.ts`, reusing `GuardRefusal.vue`, `ProfileChip.vue`
- [x] T049a [US5] Tests then code: `suggested_client` on the sign-in request payload (`internal/runtime/oauth_login_consent.go`, `internal/httpapi/oauth_login.go`, `internal/contracts`, `make swagger`): exactly one case-insensitive match on id, display name or known client name → present with `matched`; none or several → absent; one client matching on several fields is one match (`matched` precedence `id`, `display_name`, `known_name`); a name equal to one client's id and another's display name → absent; a trailing parenthesised suffix is also tried without it; never on a per-client address; with a suggestion present, preview without a client answers `200 {complete:false}` with no access and no guard, and approve without a client answers `422 client_required` and writes nothing
- [x] T050 [US5] Vitest in `frontend/tests/unit/authorize-request.spec.ts` for the generic address: "New client" selected when there is no `suggested_client`, the suggested client selected with the unverified-name notice when there is one, changing the selection sends the changed client, "New client" with editable id and name, existing-client choice shows the access sentence, `identity_exists` / `reserved_identity` errors
- [x] T051 [US5] Implement the generic-address branch in `frontend/src/views/AuthorizeRequest.vue`
- [x] T052 [US4] Vitest then code: with no API key in storage `AuthorizeRequest.vue` shows only "Open from the tray or paste the API key", makes no request-detail call, and continues after a pasted key (`frontend/tests/unit/authorize-request-nokey.spec.ts`)
- [x] T053 [US4] Test then code: `frame-ancestors 'none'` (and `X-Frame-Options: DENY`) on `/ui/authorize` in `internal/server/server.go` (`internal/server/oauth_login_http_test.go`)

### Phase 10: Tray (US4)

Expand Down
Loading