Bind a worker's name and labels into its token; list and revoke tokens by jti
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013GAeg4Jo6xjZzjwy9QDWMQ
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
"""worker_token
|
||||
|
||||
Every worker credential a superuser mints, by the `jti` it carries, so one can
|
||||
be listed and revoked without rotating the key that signs them all.
|
||||
|
||||
Revision ID: b7d2e9c4a1f3
|
||||
Revises: f8c3e5a91d27
|
||||
Create Date: 2026-10-06
|
||||
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
import sqlmodel.sql.sqltypes
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "b7d2e9c4a1f3"
|
||||
down_revision = "f8c3e5a91d27"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
"worker_token",
|
||||
sa.Column("jti", sqlmodel.sql.sqltypes.AutoString(length=32), nullable=False),
|
||||
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False),
|
||||
sa.Column("labels", sa.JSON(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("expires_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("revoked_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.PrimaryKeyConstraint("jti"),
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_table("worker_token")
|
||||
Reference in New Issue
Block a user