portal: the member identity route — GET /api/v1/me answers who holds the session and whether they are live, through the composed decider (spec #1361 s29) #1362

Closed
opened 2026-09-10 00:56:26 +00:00 by ben · 2 comments
Owner

Parent

Spec #1361 (the Portal); program map #1336; design contract DDR 0232 / ADR 0233, flow docs/ux/flows/portal.mermaid, wireframes docs/ux/wireframes/portal/. Slice me-route in docs/slices/portal.yaml.

What to build

GET /api/v1/me on the apex: cookie-resolved through the gate's session resolver, answered through the COMPOSED decider (kanidm GateDecision / IDIP Standing) — never the bare cookie. {sub, display_name, tier, live, operator, first_login, resting}. Not-live clears the cookie; no cookie → 401; substrate not wired → resting:true, never 500; observes the roster's first-sign-in transition exactly as the gate does. Display name from the route's own lookups (kanidm person / IDIP roster), never an ungated operator route. Handler tests with fake decider + resolver.

Acceptance criteria

  • Given a live active member's session cookie and no identity header, when GET /api/v1/me is called at the apex, then it answers {sub, display_name, tier, live:true, operator, first_login, resting:false} computed through the composed decider.
  • Given a suspended member's still-valid cookie, when it is called, then it answers live:false and the response clears the cookie.
  • Given no cookie, when it is called, then it answers 401.
  • Given no apex or no gate OIDC secret (the substrate rests), when it is called, then it answers resting:true and never 500.
  • Given an operator's cookie, when it is called, then operator:true; a plain member's → false.
  • Given a never-signed-in member whose first landing is the Portal, when /me answers live, then the roster's first-sign-in transition fires exactly as it does at the gate.
  • Given the IDIP tier, when it is called with an AID-subject cookie, then live comes from the roster's Standing and display_name from the roster, with no steward-gated route involved.

Blocked by

  • None — can start immediately (bootstrap:skeleton is closed).

Task manifest

task: me-route
implements_flow: portal
implements_edge: PT-S0→PT-S1 (the identity route answers live / not live / resting)
wireframe: ''
interface: GET /api/v1/me → {sub, display_name, tier, live, operator, first_login, resting}
seam: controlapi handler tests (fake decider/resolver)
acceptance:
- given: a live active member's session cookie and no identity header
  when: GET /api/v1/me is called at the apex
  then: it answers {sub, display_name, tier, live:true, operator, first_login, resting:false} computed
    through the composed decider
- given: a suspended member's still-valid cookie
  when: it is called
  then: it answers live:false and the response clears the cookie
- given: no cookie
  when: it is called
  then: it answers 401
- given: no apex or no gate OIDC secret (the substrate rests)
  when: it is called
  then: it answers resting:true and never 500
- given: an operator's cookie
  when: it is called
  then: operator:true; a plain member's → false
- given: a never-signed-in member whose first landing is the Portal
  when: /me answers live
  then: the roster's first-sign-in transition fires exactly as it does at the gate
- given: the IDIP tier
  when: it is called with an AID-subject cookie
  then: live comes from the roster's Standing and display_name from the roster, with no steward-gated
    route involved
depends_on:
- bootstrap:skeleton
out_of_scope:
- operator truth on the Portal
- operator notices / per-service public switch
- IDIP identity door
- mail on IDIP (stated limit)
- IDIP browser sign-in UX (#1302)
needs_human_decision: []
## Parent Spec **#1361** (the Portal); program map **#1336**; design contract DDR 0232 / ADR 0233, flow `docs/ux/flows/portal.mermaid`, wireframes `docs/ux/wireframes/portal/`. Slice `me-route` in `docs/slices/portal.yaml`. ## What to build GET /api/v1/me on the apex: cookie-resolved through the gate's session resolver, answered through the COMPOSED decider (kanidm GateDecision / IDIP Standing) — never the bare cookie. {sub, display_name, tier, live, operator, first_login, resting}. Not-live clears the cookie; no cookie → 401; substrate not wired → resting:true, never 500; observes the roster's first-sign-in transition exactly as the gate does. Display name from the route's own lookups (kanidm person / IDIP roster), never an ungated operator route. Handler tests with fake decider + resolver. ## Acceptance criteria - [ ] Given a live active member's session cookie and no identity header, when GET /api/v1/me is called at the apex, then it answers {sub, display_name, tier, live:true, operator, first_login, resting:false} computed through the composed decider. - [ ] Given a suspended member's still-valid cookie, when it is called, then it answers live:false and the response clears the cookie. - [ ] Given no cookie, when it is called, then it answers 401. - [ ] Given no apex or no gate OIDC secret (the substrate rests), when it is called, then it answers resting:true and never 500. - [ ] Given an operator's cookie, when it is called, then operator:true; a plain member's → false. - [ ] Given a never-signed-in member whose first landing is the Portal, when /me answers live, then the roster's first-sign-in transition fires exactly as it does at the gate. - [ ] Given the IDIP tier, when it is called with an AID-subject cookie, then live comes from the roster's Standing and display_name from the roster, with no steward-gated route involved. ## Blocked by - None — can start immediately (bootstrap:skeleton is closed). ## Task manifest ```yaml task: me-route implements_flow: portal implements_edge: PT-S0→PT-S1 (the identity route answers live / not live / resting) wireframe: '' interface: GET /api/v1/me → {sub, display_name, tier, live, operator, first_login, resting} seam: controlapi handler tests (fake decider/resolver) acceptance: - given: a live active member's session cookie and no identity header when: GET /api/v1/me is called at the apex then: it answers {sub, display_name, tier, live:true, operator, first_login, resting:false} computed through the composed decider - given: a suspended member's still-valid cookie when: it is called then: it answers live:false and the response clears the cookie - given: no cookie when: it is called then: it answers 401 - given: no apex or no gate OIDC secret (the substrate rests) when: it is called then: it answers resting:true and never 500 - given: an operator's cookie when: it is called then: operator:true; a plain member's → false - given: a never-signed-in member whose first landing is the Portal when: /me answers live then: the roster's first-sign-in transition fires exactly as it does at the gate - given: the IDIP tier when: it is called with an AID-subject cookie then: live comes from the roster's Standing and display_name from the roster, with no steward-gated route involved depends_on: - bootstrap:skeleton out_of_scope: - operator truth on the Portal - operator notices / per-service public switch - IDIP identity door - mail on IDIP (stated limit) - IDIP browser sign-in UX (#1302) needs_human_decision: [] ```

swarm-claim host=matou-dev-server-01 run=20996
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=20996 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #1362 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1362,
  "status": "success",
  "commits": [
    "913dc3fa4e53f70740e85f2a3086943f3cb481b3"
  ],
  "changed_files": [
    "STATUS.md",
    "control-plane/cmd/control-plane/main.go",
    "dashboard/src/lib/api/generated.ts",
    "internal/controlapi/me.go",
    "internal/controlapi/me_adapter_test.go",
    "internal/controlapi/me_test.go",
    "internal/member/self.go",
    "internal/member/self_test.go",
    "packages/openapi-spec/openapi.yaml"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci --command go test ./internal/controlapi/ ./internal/member/ ./control-plane/cmd/control-plane/",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci --command golangci-lint run ./internal/controlapi/... ./internal/member/... ./control-plane/cmd/control-plane/...",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci --command go build ./...",
      "exit_code": 0
    },
    {
      "command": "node packages/openapi-spec/scripts/generate-client.mjs --check",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Given a live active member's session cookie and no identity header, when GET /api/v1/me is called at the apex, then it answers {sub, display_name, tier, live:true, operator, first_login, resting:false} computed through the composed decider": "internal/controlapi/me.go registerMe maps MeDecider.Whoami onto meResponse; internal/controlapi/me_test.go TestMe_LiveMemberAnswersComposedIdentity asserts the full object; kanidm path member/self.go Whoami + self_test.go TestWhoami_FirstLandingFiresFirstSignIn",
    "Given a suspended member's still-valid cookie, when it is called, then it answers live:false and the response clears the cookie": "me.go: !st.Live → http.SetCookie(ClearSessionCookie(apex)) + live:false; me_test.go TestMe_SuspendedAnswersNotLiveAndClearsCookie; member self_test.go TestWhoami_SuspendedReadsNotLive",
    "Given no cookie, when it is called, then it answers 401": "me.go: resolver.Resolve !ok → 401 unauthenticated; me_test.go TestMe_NoCookieIs401",
    "Given no apex or no gate OIDC secret (the substrate rests), when it is called, then it answers resting:true and never 500": "me.go: nil decider → meResponse{Resting:true} 200; main.go passes a nil decider when gateResolver is nil (apex+gate secret missing); me_test.go TestMe_RestingSubstrateAnswersResting",
    "Given an operator's cookie, when it is called, then operator:true; a plain member's -> false": "me.go carries st.Operator; me_test.go TestMe_OperatorFlag; kanidm member self_test.go TestWhoami_OperatorReadsOperator (ledger RoleOperator)",
    "Given a never-signed-in member whose first landing is the Portal, when /me answers live, then the roster's first-sign-in transition fires exactly as it does at the gate": "member/self.go Whoami calls o.FirstLogin(sub) before reading standing (same call the gate makes in authgate.go), so a StatusNeverSignedIn by-hand member is activated and first_login reports the prompt; self_test.go TestWhoami_FirstLandingFiresFirstSignIn asserts live+first_login on the first read and quiet no-op on the second",
    "Given the IDIP tier, when it is called with an AID-subject cookie, then live comes from the roster's Standing and display_name from the roster, with no steward-gated route involved": "internal/controlapi/me.go NewIdipMeDecider composes IdipGateRoster.Standing (live), OperatorCheck.IsOperator and IdipMemberNames (roster name) — no steward route; wired in main.go productionIdip over keria.NewGateRoster/RosterAdapter; me_adapter_test.go TestIdipMeDecider_ComposesRosterStanding + me_test.go TestMe_IdipTier"
  },
  "summary": "Built GET /api/v1/me: the Portal's member identity route, cookie-resolved and answered through the tier's composed decider (kanidm ledger+first-login / IDIP roster Standing), with a not-live cookie cleared, no-cookie 401, and a resting substrate answering resting:true.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #1362 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1362, "status": "success", "commits": [ "913dc3fa4e53f70740e85f2a3086943f3cb481b3" ], "changed_files": [ "STATUS.md", "control-plane/cmd/control-plane/main.go", "dashboard/src/lib/api/generated.ts", "internal/controlapi/me.go", "internal/controlapi/me_adapter_test.go", "internal/controlapi/me_test.go", "internal/member/self.go", "internal/member/self_test.go", "packages/openapi-spec/openapi.yaml" ], "tests": [ { "command": "nix develop .#go-ci --command go test ./internal/controlapi/ ./internal/member/ ./control-plane/cmd/control-plane/", "exit_code": 0 }, { "command": "nix develop .#go-ci --command golangci-lint run ./internal/controlapi/... ./internal/member/... ./control-plane/cmd/control-plane/...", "exit_code": 0 }, { "command": "nix develop .#go-ci --command go build ./...", "exit_code": 0 }, { "command": "node packages/openapi-spec/scripts/generate-client.mjs --check", "exit_code": 0 } ], "criteria": { "Given a live active member's session cookie and no identity header, when GET /api/v1/me is called at the apex, then it answers {sub, display_name, tier, live:true, operator, first_login, resting:false} computed through the composed decider": "internal/controlapi/me.go registerMe maps MeDecider.Whoami onto meResponse; internal/controlapi/me_test.go TestMe_LiveMemberAnswersComposedIdentity asserts the full object; kanidm path member/self.go Whoami + self_test.go TestWhoami_FirstLandingFiresFirstSignIn", "Given a suspended member's still-valid cookie, when it is called, then it answers live:false and the response clears the cookie": "me.go: !st.Live → http.SetCookie(ClearSessionCookie(apex)) + live:false; me_test.go TestMe_SuspendedAnswersNotLiveAndClearsCookie; member self_test.go TestWhoami_SuspendedReadsNotLive", "Given no cookie, when it is called, then it answers 401": "me.go: resolver.Resolve !ok → 401 unauthenticated; me_test.go TestMe_NoCookieIs401", "Given no apex or no gate OIDC secret (the substrate rests), when it is called, then it answers resting:true and never 500": "me.go: nil decider → meResponse{Resting:true} 200; main.go passes a nil decider when gateResolver is nil (apex+gate secret missing); me_test.go TestMe_RestingSubstrateAnswersResting", "Given an operator's cookie, when it is called, then operator:true; a plain member's -> false": "me.go carries st.Operator; me_test.go TestMe_OperatorFlag; kanidm member self_test.go TestWhoami_OperatorReadsOperator (ledger RoleOperator)", "Given a never-signed-in member whose first landing is the Portal, when /me answers live, then the roster's first-sign-in transition fires exactly as it does at the gate": "member/self.go Whoami calls o.FirstLogin(sub) before reading standing (same call the gate makes in authgate.go), so a StatusNeverSignedIn by-hand member is activated and first_login reports the prompt; self_test.go TestWhoami_FirstLandingFiresFirstSignIn asserts live+first_login on the first read and quiet no-op on the second", "Given the IDIP tier, when it is called with an AID-subject cookie, then live comes from the roster's Standing and display_name from the roster, with no steward-gated route involved": "internal/controlapi/me.go NewIdipMeDecider composes IdipGateRoster.Standing (live), OperatorCheck.IsOperator and IdipMemberNames (roster name) — no steward route; wired in main.go productionIdip over keria.NewGateRoster/RosterAdapter; me_adapter_test.go TestIdipMeDecider_ComposesRosterStanding + me_test.go TestMe_IdipTier" }, "summary": "Built GET /api/v1/me: the Portal's member identity route, cookie-resolved and answered through the tier's composed decider (kanidm ledger+first-login / IDIP roster Standing), with a not-live cookie cleared, no-cookie 401, and a resting substrate answering resting:true.", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#1362
No description provided.