Admin Account System
The Manage service implements a purpose-built administrator directory that is separate from customer identities. It stores control-plane operators, delegated tenant managers, and read-only auditors together with the access credentials required to call privileged APIs.
Account Personas and Records
Every administrator entry stores an immutable id, display name, granted
role, and optional contact metadata. Platform operators run the Helium cloud
and may assume any tenant context. Tenant administrators belong to a single
customer tenant and can invite peers. Auditors observe configuration and
compliance state without mutation rights. Each record retains lifecycle
timestamps (creation, last login, invitation usage) so governance reports can be
produced without touching runtime logs.
Registration Workflow
Administrator onboarding is handled by invitation and implemented inside
AdminAuthService:
- Invitation lookup – The service receives a
RegisterAdmincommand and usesFindAdminInvitationByTokento retrieve the invitation that seeded the registration. Missing invitations resolve toRegisterAdminResult::InvalidInvitation. - Usage guard – If the invitation was already consumed (
invitation.used), the service short-circuits withRegisterAdminResult::InvitationUsedto stop replayed activation links. - Account creation – A new UUID is minted and passed to
CreateAdminAccounttogether with the invite’s role and the operator-supplied profile fields. This persists the administrator row and binds it to the permission set determined during invitation issuance. - API key provisioning –
generate_admin_tokenproduces an opaque API key (passkey). The token plus key label (key_name) are stored throughCreateAdminToken, ensuring future logins can authenticate against the database record. - Invitation finalization –
UseAdminInvitationmarks the invitation as used so the one-time link cannot be replayed. - Response – The service returns
RegisterAdminResult::Successwith the freshly createdadmin_idand the plaintext API token. The caller is responsible for presenting that key securely to the new administrator; it is never persisted in plaintext elsewhere.
This flow guarantees that registration can only occur with a valid invitation and that each administrator starts with at least one API credential for future logins.
Login Workflow
Subsequent logins exchange the stored API token for a short-lived JWT access credential:
- API key lookup –
AdminAuthServicereceives anAdminLogincommand containing the submitted API token that was minted during registration (or from a laterCreateAdminTokenissuance). It invokesFindAdminPasskeyByTokento resolve the underlying admin key row stored inadmin.admin_key. Absent or revoked tokens yieldAdminLoginResult::KeyNotFound. - Account hydration – With the key resolved, the service loads the
administrator profile through
FindAdminById. Missing accounts are treated as a failed login to avoid leaking information about deleted users. - JWT configuration – The service clones its Redis connection and calls
find_config_from_redis::<AdminJwtConfig>to load the current signing material, issuer, audience, and expiration settings. - Claim assembly – Using
AdminJwtClaims, the service setssubto the admin ID,nameandroleto the profile details, and timestamps (iat,exp) based onOffsetDateTime::now_utc()plus the configured TTL. - Token issuance – The encoded claims are signed using the JWT encoder from
AdminJwtConfig::encode(). On success the service returnsAdminLoginResult::Success(AdminAccessToken); failures bubble up as framework errors.
The caller receives only the access token string. Subsequent Manage API calls
must include it (for example, as a Bearer token) so workers can authorize the
request.
Access Token Semantics
The issued JWT embeds the administrator’s role in lower case (via
role.to_jwt_string().to_lowercase()), the issuer/audience pair, and the expiry
chosen by configuration. Manage workers validate tokens on every request using
the same Redis-backed configuration, checking signature validity and time-based
claims before resolving RBAC permissions. Because API tokens act as a second
factor, operators are encouraged to rotate them regularly; new keys can be
created through the same CreateAdminToken processor while old keys are revoked
out-of-band.
Account Lifecycle
Beyond registration and login, Manage provides tools for invitation management, account suspension, and archival. Suspended accounts retain their historical record but cannot authenticate until reinstated. Archival removes active credentials yet preserves audit context, ensuring the administrator directory remains authoritative for compliance reporting.