API Keys: Add revocation for SATs (#53896)

* add apikey is_revoked field

* add token store tests

* Apply suggestions from code review

* remove unused fields
This commit is contained in:
Jo
2022-08-18 16:54:39 +02:00
committed by GitHub
parent 8b18530cb8
commit 4a9137ac40
18 changed files with 235 additions and 105 deletions
@@ -95,4 +95,9 @@ func addApiKeyMigrations(mg *Migrator) {
mg.AddMigration("Add last_used_at to api_key table", NewAddColumnMigration(apiKeyV2, &Column{
Name: "last_used_at", Type: DB_DateTime, Nullable: true,
}))
// is_revoked indicates whether key is revoked or not. Revoked keys should be kept in the table, but invalid.
mg.AddMigration("Add is_revoked column to api_key table", NewAddColumnMigration(apiKeyV2, &Column{
Name: "is_revoked", Type: DB_Bool, Nullable: true, Default: "0",
}))
}