Blame · Line-by-line history
0038_cross_product_tokens.sql
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| 055ebc4 | 1 | -- Block K11 — Cross-product identity |
| 2 | -- Tracks short-lived JWTs minted by gluecron (IdP) for sibling products | |
| 3 | -- (Crontech, Gatetest). Row per mint is used for: | |
| 4 | -- * revocation (revoked_at IS NOT NULL => fail verify) | |
| 5 | -- * replay audit (jti is the JWT id) | |
| 6 | -- * settings UI listing (active per user) | |
| 7 | ||
| 8 | CREATE TABLE IF NOT EXISTS cross_product_tokens ( | |
| 9 | jti uuid PRIMARY KEY, | |
| 10 | user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE, | |
| 11 | audience text NOT NULL, | |
| 12 | scopes text NOT NULL DEFAULT '[]', | |
| 13 | issued_at timestamptz NOT NULL DEFAULT now(), | |
| 14 | expires_at timestamptz NOT NULL, | |
| 15 | revoked_at timestamptz | |
| 16 | ); | |
| 17 | ||
| 18 | CREATE INDEX IF NOT EXISTS cross_product_tokens_user_idx | |
| 19 | ON cross_product_tokens (user_id, issued_at DESC); | |
| 20 | ||
| 21 | CREATE INDEX IF NOT EXISTS cross_product_tokens_active_idx | |
| 22 | ON cross_product_tokens (audience, expires_at) | |
| 23 | WHERE revoked_at IS NULL; |