Cockpit login + Databento-style trading tokens - #21
Merged
Conversation
added 3 commits
July 27, 2026 16:22
Backend: - auth_middleware accepts a single bearer trading token (key_id.secret) alongside the existing Basic key_id:secret; shared verify_key helper. - POST/GET/DELETE /admin/trading-tokens: mint a token under a principal (existing or quick-created), optionally granting a portfolio. Tokens are api_keys; grants stay on the principal so many tokens rotate freely. - Admin console password read from OMS_ADMIN_PASSWORD (OMS_ADMIN_TOKEN still accepted as fallback). Cockpit: - Login gate + branded sign-in screen (admin password); logout; client clears the token and returns to login on 401/403. - New 'API' tab (route /tokens): create/list/revoke tokens, styled to the openOMS terminal identity with a terminal-readout credential reveal. - Retired the old Trading tokens page.
Drop the quick-create-principal path from the token flow (backend + UI). Principals are created on the Principals tab; the API tab just mints tokens for an existing one — clearer separation, no stray service principals.
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.
Summary
Adds a real cockpit login and a single-bearer trading token system for API clients / bots.
Auth
Authorization: Bearer <key_id>.<secret>token alongside the existing Basickey_id:secret(back-compat kept). Sharedverify_keyhelper inauth.rs.OMS_ADMIN_PASSWORD, falls back toOMS_ADMIN_TOKEN); logout + auto-redirect on 401/403.Trading tokens (token-per-principal)
POST/GET/DELETE /admin/trading-tokens— mint a single-bearer token under an existing principal (optionally granting a portfolio in the same call), list, revoke. Tokens areapi_keys; grants live on the principal so many tokens rotate freely.Cockpit
/tokens) styled to the openOMS terminal identity: terminal-readout credential reveal (copy-once + ready curl) and a mono token ledger with revoke.Verification
cargo test113 pass; cockpittsc+vite buildclean.Notes
OMS_ADMIN_AUTH_ENABLED=trueenables the login gate;OMS_ADMIN_PASSWORDis the console password.