Secrets: engine config editors and one-time credential generation
Adds Config tab (database connections with rotate/reset, aws root and lease, ssh CA with generate/import) and a Generate action on roles (database/static creds, aws creds, ssh sign and OTP). Secret inputs are write-only: never prefilled and omitted when blank so the stored value is kept. Issued credentials live only in a gcTime-0 mutation and are shown once, with revoke-now for leased credentials. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4fa7ff1497
commit
48746e2150
15 files changed
+1089
-18
No files matched your search
@@ -1,17 +1,36 @@
|
||||
import { useState } from 'react'
|
||||
import type { BaoClient } from '../../api/bao'
|
||||
import { engineFor } from '../../api/engines/registry'
|
||||
import type { Mount } from '../../api/secrets'
|
||||
import { ConfigPanel } from './ConfigPanel'
|
||||
import { RolesPanel } from './RolesPanel'
|
||||
|
||||
/** Roles (and, in later phases, Config / Leases) for a dynamic secrets engine. */
|
||||
type Tab = 'roles' | 'config'
|
||||
|
||||
/** Roles and Config (and, in a later phase, Leases) for a dynamic secrets engine. */
|
||||
export function EngineView({ client, mount }: { client: BaoClient; mount: Mount }) {
|
||||
const engine = engineFor(mount.type)
|
||||
const [tab, setTab] = useState<Tab>('roles')
|
||||
const tabs: { id: Tab; label: string }[] = [{ id: 'roles', label: 'Roles' }]
|
||||
if (engine.configs.length > 0) tabs.push({ id: 'config', label: 'Config' })
|
||||
const current = tabs.some((t) => t.id === tab) ? tab : 'roles'
|
||||
|
||||
return (
|
||||
<div className="engine-view">
|
||||
<h2>
|
||||
{engine.label} · {mount.path}
|
||||
</h2>
|
||||
<RolesPanel key={mount.path} client={client} mount={mount.path} engine={engine} />
|
||||
{tabs.length > 1 && (
|
||||
<div role="tablist" aria-label="Engine" className="tabs">
|
||||
{tabs.map((t) => (
|
||||
<button key={t.id} type="button" role="tab" aria-selected={t.id === current} onClick={() => setTab(t.id)}>
|
||||
{t.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{current === 'roles' && <RolesPanel key={mount.path} client={client} mount={mount.path} engine={engine} />}
|
||||
{current === 'config' && <ConfigPanel key={mount.path} client={client} mount={mount.path} engine={engine} />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user