KI-AGENT: Persistente App-Sessions mit Refresh-Tokens ergänzen

This commit is contained in:
2026-07-20 22:01:08 +02:00
parent d8273e794d
commit 657a4f9e85
11 changed files with 405 additions and 60 deletions

View File

@@ -0,0 +1,21 @@
CREATE TABLE IF NOT EXISTS "auth_refresh_tokens" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"user_id" uuid NOT NULL,
"tenant_id" bigint,
"token_hash" text NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"expires_at" timestamp with time zone NOT NULL,
"revoked_at" timestamp with time zone,
CONSTRAINT "auth_refresh_tokens_token_hash_unique" UNIQUE("token_hash"),
CONSTRAINT "auth_refresh_tokens_user_id_auth_users_id_fk"
FOREIGN KEY ("user_id") REFERENCES "public"."auth_users"("id")
ON DELETE cascade ON UPDATE cascade,
CONSTRAINT "auth_refresh_tokens_tenant_id_tenants_id_fk"
FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id")
ON DELETE set null ON UPDATE cascade
);
CREATE INDEX IF NOT EXISTS "auth_refresh_tokens_user_id_idx"
ON "auth_refresh_tokens" ("user_id");
CREATE INDEX IF NOT EXISTS "auth_refresh_tokens_expires_at_idx"
ON "auth_refresh_tokens" ("expires_at");

View File

@@ -372,6 +372,13 @@
"when": 1784021669805,
"tag": "0055_tenant_export_maintenance_lock",
"breakpoints": true
},
{
"idx": 53,
"version": "7",
"when": 1784548800000,
"tag": "0056_auth_refresh_tokens",
"breakpoints": true
}
]
}