Repository navigation
[M2.2e1b] Add typed identity transport and session state - #64
Merged
Merged
Conversation
4 tasks done
samuelmbabhazi
force-pushed
the
fix/m2.2e1a-client-contract
branch
from
November 5, 2026 12:37
019269c to
486ab5b
Compare
samuelmbabhazi
changed the base branch from
fix/m2.2e1a-client-contract
to
main
November 5, 2026 12:37
samuelmbabhazi
force-pushed
the
feat/m2.2e1b-web-identity-client
branch
from
November 5, 2026 12:37
fa1fe5c to
50fe6bd
Compare
samuelmbabhazi
added a commit
that referenced
this pull request
Nov 5, 2026
Identity forms now have a component-scoped mutation runner that suppresses double submissions, preserves an unchanged request's key after uncertain failures and discards late results after a form reset or destruction. Retries stop after four minutes, a backward clock change or a replay conflict, requiring an explicit restart before another operation. Known client rejections release the attempt; transport failures, HTTP 408 and server errors preserve it. Bounded Retry-After delays survive an explicit restart. Native private fields prevent credential snapshots from appearing in object serialization, and no result/secret grant is retained by the runner. Validation: all 18 Angular tests pass, including seven new retry/concurrency/destruction regressions; web lint, typecheck and production build pass. No new dependency, HTTP contract, shell invocation or server mutation. Plan/spec describe the behavior. Stacked on #64; no merge requested. - [x] M2.2e2a criteria met - [x] Retry, race, cooldown and private-state tests pass - [x] Plan/spec updated - [x] Credentials remain in component-lifetime memory only
5 of 6 tasks
samuelmbabhazi
added a commit
that referenced
this pull request
Nov 5, 2026
…rets on a timer (#98) ## Task Review follow-up for #64, #66 and #68 (M2.2e1b, M2.2e2b, M2.2e3a). Refs #21 ## What changed **Session state (`session-store.ts`)** - Sign-out on an expired or revoked session: the server answers 401, which now clears the local session instead of keeping "Signed in as …" with an error that every retry repeats. - A successful login always updates the session, even if its form was left before the response arrived. The server has already set the session cookie, so the UI no longer claims the user is signed out while the next reload is authenticated. Form side effects (navigation) remain guarded by the mutation runner. - A login that fails while it superseded a pending session check re-runs the check, so the account page no longer stays on "Checking your session…" until reload. **One-time secrets (`mfa-form-store.ts`, `token-form-store.ts`)** - Recovery codes and newly created API tokens are no longer hidden by a fixed 10-minute timer. They stay until the user acknowledges them, leaves the page or rotates the session. - The provisioning seed keeps its timer, which follows the real server expiry. - Panel texts and SPEC updated. ## Why - The 401 sign-out trapped users in a signed-in UI until a full reload (#64). - The ignored login left a live server session invisible to the user (#66). - The server shows recovery codes and API tokens exactly once. Hiding them after 10 minutes, with no warning or extension, fails WCAG 2.2.1 (Timing Adjustable, level A) on a core flow. A slow or screen-reader user copying ten 32-character codes could lose them and then need a TOTP code to regenerate them (#68). ## How it was tested - New and updated unit tests: 401 sign-out clears the session; a failed login that superseded a pending check settles the state; recovery codes and API tokens are still displayed after an hour without acknowledgement. - `nx run-many -t lint typecheck test build -p web` in a clean worktree: 11 files, 52 tests pass; production build passes. - Browser acceptance could not run: GitHub Actions is blocked by the account spending limit. CI must pass before merge. ## Security considerations - Secrets stay in memory longer only while the account page is open and only until acknowledgement. Departure, session rotation and acknowledgement still clear them, and they still never serialize out of the stores. - The signed-out state after a 401 matches the server state. ## Checklist - [x] Lint, typecheck, tests and build pass locally - [x] Tests added and updated - [x] No new shell invocation and no new secret exposure path - [x] Audit events: not applicable (client only) - [x] SPEC updated - [ ] CI green (blocked by billing)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The web app now has a typed identity client covering account, MFA and token-management endpoints, plus in-memory session state. Requests use the generated SDK, stay on the current origin, refuse redirects/bearer credentials, avoid caching, cap network waits at twenty seconds and attach only an unambiguous CSRF cookie. Mutation callers supply their retry keys so a UI can preserve a key across an uncertain result.
Session state retains only user ID, email and expiry, including when accepting a response that also contains recovery codes or an API token. A revision counter prevents stale requests from restoring signed-out state. Failed logout remains visibly unconfirmed; missing credentials and service outages have distinct states. UI errors use fixed safe messages and bounded Retry-After values.
Validation: web lint/typecheck, all 11 Angular tests and production build pass. Tests cover cookie/header behavior, cross-origin rejection, duplicate/insecure CSRF cookies, empty responses, sanitized errors and late session responses. The workspace SDK dependency is declared alongside the existing root Angular dependencies so the Angular/Vitest runner resolves it consistently.
Security: credentials remain in request bodies/headers and never enter URLs or browser storage. No new external package/version; only an existing workspace package is linked. Screens and real-browser acceptance follow in M2.2e2–e4. Stacked on #63; no merge requested.