Merge branch 'feature/iam-09-api-token-service-accounts' into feature/qa-02-pruefgate-identitaet-mandanten
# Conflicts: # scripts/reset-test-env.sh # scripts/run-checks.sh
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
DROP TABLE IF EXISTS api_tokens;
|
||||
DROP TABLE IF EXISTS service_accounts;
|
||||
@@ -0,0 +1,20 @@
|
||||
-- Service-Accounts & API-Token (IAM-09, siehe core-kanban/tickets/IAM-09.md).
|
||||
-- Service-Accounts sind eine eigenstaendige Identitaetsklasse neben
|
||||
-- menschlichen Benutzern (users), nicht dieselbe Tabelle (Zitadel-Vorbild).
|
||||
CREATE TABLE service_accounts (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
name TEXT NOT NULL,
|
||||
status TEXT NOT NULL DEFAULT 'active',
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
-- token_hash enthaelt NIEMALS den Klartext-Token, nur dessen SHA-256-Hash.
|
||||
CREATE TABLE api_tokens (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
service_account_id UUID NOT NULL REFERENCES service_accounts(id),
|
||||
token_hash BYTEA NOT NULL UNIQUE,
|
||||
scopes TEXT[] NOT NULL DEFAULT '{}',
|
||||
expires_at TIMESTAMPTZ,
|
||||
revoked_at TIMESTAMPTZ,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
Reference in New Issue
Block a user