feat(auth): read the real operator identity and level from WhoAmI#48
Merged
Conversation
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.
What and why
Turns the mock client-cert auth into a real one (Slice A). In live/live-auth the
AuthProvidercalls the manager'sWhoAmIand renders the verified operator (cn/serial/level); mock keeps the 600ms dev stub. Adds adeniedstate when no valid operator is returned, and sendscredentials: "include"on the fleet client so the browser presents its client certificate.Operatorgainslevel(admin|operator|viewer);AuthStatusgainsdenied.whoAmI({}); success maps identity/level (viewer fallback for an unknown level);deniedon no-operator or a rejected RPC (.catch); cancellation guard.fleet_pb.tsfrom the merged api (adds thewhoAmIclient method).Consumes the manager
WhoAmIendpoint (manager #18) and api WhoAmI (CryptOS-PKI/api#44, merged). Independent at build time.Closes #47
Verification
How this was verified
npm run test113/113,npm run lintandnpm run buildclean. Note: the denied test drives the provider's no-operator branch (a resolved response with no operator) rather than a rejected promise, to avoid a Vitest 3.2.7 false unhandled-rejection artifact; the reject path runs the same one-linesetStateand is exercised by the live cert-absent flow. Follow-up: cover the reject path once the test tooling is restructured (per-testvi.fn()instead ofmockReset()).