Some checks failed
Deploy Development / deploy (push) Failing after 42s
Test Suite / pytest-backend (push) Failing after 1s
Test Suite / k6 /api/health Baseline (push) Has been skipped
Test Suite / playwright-smoke (push) Has been skipped
Test Suite / lint-backend (push) Successful in 3s
Test Suite / compose-smoke (push) Has been skipped
Agenten authentifizieren per X-Actor-Token; /api/operational/ Fassade mit context, next-action, status, evidence; Token-Verwaltung unter /api/actors/{id}/service-tokens.
Co-authored-by: Cursor <cursoragent@cursor.com>
23 lines
1008 B
SQL
23 lines
1008 B
SQL
-- AP1.7c — Actor Service Tokens für Operational API (Vibe-Coder / Agenten)
|
|
|
|
CREATE TABLE actor_service_tokens (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
tenant_id UUID NOT NULL REFERENCES tenants(id) ON DELETE CASCADE,
|
|
actor_id UUID NOT NULL REFERENCES actors(id) ON DELETE CASCADE,
|
|
label VARCHAR(255) NOT NULL,
|
|
token_prefix VARCHAR(16) NOT NULL,
|
|
token_hash VARCHAR(64) NOT NULL,
|
|
capabilities JSONB NOT NULL DEFAULT '[]'::jsonb,
|
|
is_active BOOLEAN NOT NULL DEFAULT TRUE,
|
|
expires_at TIMESTAMPTZ NULL,
|
|
last_used_at TIMESTAMPTZ NULL,
|
|
created_by_user_id UUID NULL REFERENCES users(id) ON DELETE SET NULL,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
revoked_at TIMESTAMPTZ NULL,
|
|
UNIQUE (token_prefix)
|
|
);
|
|
|
|
CREATE INDEX idx_actor_service_tokens_tenant ON actor_service_tokens(tenant_id);
|
|
CREATE INDEX idx_actor_service_tokens_actor ON actor_service_tokens(actor_id);
|
|
CREATE INDEX idx_actor_service_tokens_hash ON actor_service_tokens(token_hash);
|