ADR-0131: Keycloak sign-in in the Windows engineering client
Foundation / checks (ecs) (push) Successful in 2m21s
Foundation / checks (deploy) (push) Successful in 4m1s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 7m21s
Foundation / checks (network) (push) Canceled after 9m43s
Foundation / checks (checks) (push) Canceled after 9m49s
Foundation / checks (postgres) (push) Canceled after 9m43s
Foundation / checks (client) (push) Canceled after 9m48s

Sign In / Register opens the system browser (PKCE S256, loopback 127.0.0.1:47600)
and keeps the refresh token in Windows Credential Manager. The client then fetches
a 10-minute grant from grants.aeternalisgames.com and connects to the cellular DEV
region. It renews the grant about a minute before expiry through SessionRefresh,
and again after a lost connection. Sign Out closes the session and revokes the
login at the broker and at Keycloak. Grant replies are cross-checked against the
grant record before use. The manual grant-bundle path stays for developers.

The bounded JSON reader moves to evo_json (evo::serialization), shared by the
broker and the client. Adds the client-auth tests. Completes work started in
another session: main.cpp wiring, refresh expiry tracking, no requests for a
superseded session, and clang-tidy and Windows header-order fixes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-15 15:31:33 -04:00
co-authored by Claude Opus 5.5
parent dec34f39e4
commit 2a5c0d0e22
22 changed files with 1622 additions and 72 deletions
@@ -73,6 +73,30 @@ never be minted on a client.
4. On logout: `POST /logout`, then revoke the refresh token at Keycloak's revocation
endpoint.
### Client implementation (Windows engineering client)
- `evo_client_auth`: the protocol parsers (`protocol.cpp`), one worker thread
(`AuthClient`, `client.cpp`) and the Windows platform (`windows.cpp`). On other
systems sign-in is unavailable, and the manual grant-bundle path remains.
- Sign-in opens the system browser with PKCE S256 and a random state. A loopback
listener on `127.0.0.1:47600` accepts exactly one `/callback` with that state and an
`iss` of the realm, if present. The password never reaches the client.
- The refresh token is stored only in Windows Credential Manager
(`AeternalisEvolution/DEV/refresh-token/v1`). Rotation removes the stored token
before it is sent, so a lost reply ends the login instead of replaying a consumed
token. Access tokens and grants stay in memory and are zeroed when dropped.
- A grant reply is accepted only if its JSON agrees with the grant record: marker,
version, dev environment, account, region, expiry (at most 15 minutes ahead) and a
nonzero serial. The region still verifies the signature.
- The region CA file is still required from the launcher. Endpoint and TLS name come
from the broker's route.
- The session asks for a new grant about 60 s before its expiry, extended by each
accepted `SessionRefresh`, and after a lost connection. It never asks for a session
that was superseded or cancelled. Requests are at least 5 s apart.
- Sign-out closes the session, then calls `/logout` (broker revocation) and Keycloak
revocation, and clears the stored token. If revocation cannot be confirmed, the
client says so: issued grants may live until they expire.
### Deployment (DEV)
- `deploy/kubernetes/grant-broker-dev`, a component of `region/dev` so it runs the