D2 — Forge user lifecycle (REST client + create/check/token-gen flow) #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
D2 — Forge user lifecycle (REST client + create/check/token-gen flow)
Sub-issue of
#?(v0.1 scope). Wires the deployer to Forge as the identity authority.What this does
Per the meeting notes: "go on forge, over rest — check that user exists, if user does not exist, create the user — random password, generate a forge key".
Implementation:
hero_os_tfgrid_deployer_server. Probablycrates/hero_os_tfgrid_deployer_server/src/forge/mod.rswith a singleForgeClientstruct holding the base URL + admin token.ForgeClient::user_exists(username) -> Result<Option<User>>— GET/api/v1/users/<username>— returns the user if present, None on 404, error on other failures.ForgeClient::create_user(username, display_name, email) -> Result<User>— POST/api/v1/admin/userswith a generated random password (alphanumeric, 32 chars). Requires admin scope on the deployer's Forge token.ForgeClient::generate_token_for(user, scopes) -> Result<TokenString>— Forge's "create access token" admin endpoint, on behalf of the new user. Token captured + stored as a hero_proc secret keyeddeployer/users/<user_id>/forge_token.OpenRPC additions to deployer
deployer.create_user(username, display_name?, email?) -> { user_id, forge_username, initial_password, forge_token_set: bool }deployer.get_user(user_id) -> Userdeployer.list_users() -> [User]deployer.delete_user(user_id)— removes from deployer sqlite; does NOT delete from Forge (admin operator handles Forge cleanup if wanted)Admin UI
In
_admincrate, add/userspage:deployer.create_userAuth model
The deployer's Forge admin token is itself a hero_proc secret:
deployer/forge_admin_token. Set once during deployer install. NEVER in code, env vars, or sqlite.Open questions for Forge / admin team
POST /api/v1/admin/usersallow a service token to set the initial password directly, or does it auto-generate + email the user? We want admin-set, share-OOB.<username>@nomail.demo.ourworld.tf) and let users update it later via cockpit's settings page.These map to
/forge_apiskill notes; will check there first, then escalate to admin if unanswered.Acceptance criteria
deployer.create_userend-to-end against forge.ourworld.tf — checks if exists, creates if not, generates Forge token, stores in hero_proc secretdeployer_test_*username convention so we can re-run without polluting Forge)References
#1/forge_api#?(v0.1 scope)