003_external_accounts.sql (776B)
1 -- 003_external_accounts.sql - accounts provisioned by an identity provider 2 -- 3 -- With OIDC the provider owns identity, but the conductor still needs a 4 -- local row for each person: projects and worker tokens reference users(id), 5 -- so a user who exists only inside a token cannot own anything. 6 -- 7 -- An account is therefore created the first time someone presents a valid 8 -- token, keyed by issuer and subject rather than by the display name, which 9 -- a provider is free to change. The local row carries the role most 10 -- recently seen in a token, so revoking a role at the provider takes effect 11 -- on the next request rather than requiring a change here as well. 12 13 ALTER TABLE users ADD COLUMN external_id TEXT; 14 15 CREATE UNIQUE INDEX idx_users_external ON users (external_id);