Mango HTTP API
Mango is the identity and authorization service. It issues and validates tokens, enforces RBAC, manages users/orgs/teams/roles/tasks, serves audit verification, and bridges revocation events to Sol.
The generated OpenAPI document is available at GET /openapi when the deployment enables it; both /openapi and /metrics are loopback or bearer-gated.
Conventions
JSON request/response bodies. A non-object JSON body is rejected with 400 before auth.
Auth is a bearer token (Authorization: Bearer) or the Sol-issued service token for service-to-service calls.
Pagination uses /page/<route> variants and a documented envelope envelope.
Every mutation writes an audit row; secrets are never logged.
Rate limits are per-IP and per-account; failed authentication is the only path that spends the account limiter.
Health and readiness
| Method | Path | Notes |
|---|---|---|
| GET | /health | Liveness + dependency data |
| GET | /ready | Readiness, including the schema/DB probe |
| GET | /metrics | Loopback/bearer-gated; always registered |
| GET | /openapi | Conditional on the deployment lever |
Authentication
| Method | Path | Purpose |
|---|---|---|
| POST | /auth/login | Username/password login; sets session cookies on success |
| POST | /auth/logout | Revokes the token and clears cookies |
| POST | /auth/validate | Validates a token; returns identity + permissions |
| POST | /auth/service-token | Mints a scoped service token (TTL and live-token caps apply) |
| GET | /auth/service-tokens | Lists live service tokens (self; admin with ?user_uuid=) |
| POST | /auth/revocations | Service-token revocation feed (service tokens only) |
| POST | /auth/change-password | Password change with lockout/rate limits |
| POST | /auth/accounts/:uuid/lock | Admin unlock |
| POST | /auth/users/:uuid/tokens | Revoke all tokens for a user |
| POST | /auth/tokens/:id/revoke | Revoke one token |
| POST | /auth/users/:uuid/ldap-tombstone | Clear a revalidation tombstone (audited) |
Orchestrator lease
| Method | Path | Purpose |
|---|---|---|
| POST | /orchestrator/lease | Acquire/renew the orchestration lease (heartbeat is a verdict on this route) |
| POST | /orchestrator/lease/takeover | Take over the lease under the takeover authority |
Users, orgs, roles, tasks
| Resource | Paths |
|---|---|
| Users | GET/POST /users, GET/PUT/DELETE /users/:uuid, GET /users/page/:n, GET /users/:uuid/tasks, GET /users/:uuid/permissions |
| Orgs | GET/POST /orgs, GET/PUT/DELETE /orgs/:uuid, GET /orgs/page/:n |
| Teams | GET/POST /orgs/:org/teams, GET/PUT/DELETE /orgs/:org/teams/:team, GET /orgs/:org/teams/page/:n |
| Roles | GET/POST /roles, GET/PUT/DELETE /roles/:uuid, GET /roles/page/:n, GET/PUT/DELETE /teams/:team/roles/:role |
| Tasks | GET/POST /tasks, GET/PUT/DELETE /tasks/:uuid, GET /tasks/page/:n, POST /tasks/:uuid/assign/:assignee |
| Membership | GET/PUT/DELETE /orgs/:org/users/:user, GET/PUT/DELETE /teams/:team/users/:user |
| Cost/usage | GET/PUT /teams/:team/cost-centers, GET/PUT /teams/:team/members/:user/caps, GET /teams/:team/usage-attribution |
The exact method set per route is in the OpenAPI document; mutations are RBAC-gated and audit-logged.
Audit
| Method | Path | Purpose |
|---|---|---|
| POST | /api/mango/audit-archive | Ingest a batch of audit events from Sol (HMAC over exact bytes; idempotent row ids) |
Mango maintains its own HMAC-chained audit_logs table with a signed checkpoint anchor and a retention floor. Operators verify with Audit.verify_integrity; a truncated head/tail, sequence rewind, or invalid checkpoint is a typed verdict.
Revocation bridge
Mango publishes token.revoked events to Sol over the bridge (HMAC v2 wire, freshness window + nonce replay guard). Sol clears its auth cache on receipt and resyncs on reconnect and every 60 seconds.
Errors
Mango uses a typed error envelope. A dependency outage returns 503, never a bare 500. Auth failures are enumeration-resistant.
Next
Authentication flow RBAC scopes Mango configuration Security model