@authrim/setup 0.1.141 → 0.1.142

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/__tests__/keys.test.js.map +1 -1
  2. package/dist/__tests__/migrate.test.js +4 -4
  3. package/dist/__tests__/migrate.test.js.map +1 -1
  4. package/dist/__tests__/paths.test.js.map +1 -1
  5. package/dist/cli/commands/deploy.d.ts.map +1 -1
  6. package/dist/cli/commands/deploy.js +57 -63
  7. package/dist/cli/commands/deploy.js.map +1 -1
  8. package/dist/cli/commands/init.d.ts.map +1 -1
  9. package/dist/cli/commands/init.js +231 -171
  10. package/dist/cli/commands/init.js.map +1 -1
  11. package/dist/core/admin.d.ts.map +1 -1
  12. package/dist/core/admin.js +13 -3
  13. package/dist/core/admin.js.map +1 -1
  14. package/dist/core/cloudflare.d.ts +38 -1
  15. package/dist/core/cloudflare.d.ts.map +1 -1
  16. package/dist/core/cloudflare.js +729 -115
  17. package/dist/core/cloudflare.js.map +1 -1
  18. package/dist/core/config.d.ts +136 -28
  19. package/dist/core/config.d.ts.map +1 -1
  20. package/dist/core/config.js +58 -11
  21. package/dist/core/config.js.map +1 -1
  22. package/dist/core/deploy.d.ts +18 -0
  23. package/dist/core/deploy.d.ts.map +1 -1
  24. package/dist/core/deploy.js +126 -25
  25. package/dist/core/deploy.js.map +1 -1
  26. package/dist/core/keys.d.ts.map +1 -1
  27. package/dist/core/keys.js +2 -0
  28. package/dist/core/keys.js.map +1 -1
  29. package/dist/core/login-ui-client.d.ts.map +1 -1
  30. package/dist/core/login-ui-client.js +43 -7
  31. package/dist/core/login-ui-client.js.map +1 -1
  32. package/dist/core/paths.d.ts.map +1 -1
  33. package/dist/core/paths.js +5 -5
  34. package/dist/core/paths.js.map +1 -1
  35. package/dist/core/tenant-mode.d.ts +4 -0
  36. package/dist/core/tenant-mode.d.ts.map +1 -0
  37. package/dist/core/tenant-mode.js +17 -0
  38. package/dist/core/tenant-mode.js.map +1 -0
  39. package/dist/core/ui-deployment.d.ts +21 -0
  40. package/dist/core/ui-deployment.d.ts.map +1 -0
  41. package/dist/core/ui-deployment.js +90 -0
  42. package/dist/core/ui-deployment.js.map +1 -0
  43. package/dist/core/ui-env.d.ts +17 -0
  44. package/dist/core/ui-env.d.ts.map +1 -1
  45. package/dist/core/ui-env.js +16 -0
  46. package/dist/core/ui-env.js.map +1 -1
  47. package/dist/core/url-config.d.ts +16 -0
  48. package/dist/core/url-config.d.ts.map +1 -0
  49. package/dist/core/url-config.js +46 -0
  50. package/dist/core/url-config.js.map +1 -0
  51. package/dist/core/wrangler.d.ts +50 -1
  52. package/dist/core/wrangler.d.ts.map +1 -1
  53. package/dist/core/wrangler.js +169 -55
  54. package/dist/core/wrangler.js.map +1 -1
  55. package/dist/i18n/locales/de.d.ts.map +1 -1
  56. package/dist/i18n/locales/de.js +37 -0
  57. package/dist/i18n/locales/de.js.map +1 -1
  58. package/dist/i18n/locales/en.d.ts.map +1 -1
  59. package/dist/i18n/locales/en.js +37 -0
  60. package/dist/i18n/locales/en.js.map +1 -1
  61. package/dist/i18n/locales/es.d.ts.map +1 -1
  62. package/dist/i18n/locales/es.js +37 -0
  63. package/dist/i18n/locales/es.js.map +1 -1
  64. package/dist/i18n/locales/fr.d.ts.map +1 -1
  65. package/dist/i18n/locales/fr.js +37 -0
  66. package/dist/i18n/locales/fr.js.map +1 -1
  67. package/dist/i18n/locales/id.d.ts.map +1 -1
  68. package/dist/i18n/locales/id.js +37 -0
  69. package/dist/i18n/locales/id.js.map +1 -1
  70. package/dist/i18n/locales/ja.d.ts.map +1 -1
  71. package/dist/i18n/locales/ja.js +37 -0
  72. package/dist/i18n/locales/ja.js.map +1 -1
  73. package/dist/i18n/locales/ko.d.ts.map +1 -1
  74. package/dist/i18n/locales/ko.js +37 -0
  75. package/dist/i18n/locales/ko.js.map +1 -1
  76. package/dist/i18n/locales/pt.d.ts.map +1 -1
  77. package/dist/i18n/locales/pt.js +37 -0
  78. package/dist/i18n/locales/pt.js.map +1 -1
  79. package/dist/i18n/locales/ru.d.ts.map +1 -1
  80. package/dist/i18n/locales/ru.js +37 -0
  81. package/dist/i18n/locales/ru.js.map +1 -1
  82. package/dist/i18n/locales/zh-CN.d.ts.map +1 -1
  83. package/dist/i18n/locales/zh-CN.js +37 -0
  84. package/dist/i18n/locales/zh-CN.js.map +1 -1
  85. package/dist/i18n/locales/zh-TW.d.ts.map +1 -1
  86. package/dist/i18n/locales/zh-TW.js +37 -0
  87. package/dist/i18n/locales/zh-TW.js.map +1 -1
  88. package/dist/i18n/types.d.ts +8 -0
  89. package/dist/i18n/types.d.ts.map +1 -1
  90. package/dist/index.js +38 -29
  91. package/dist/index.js.map +1 -1
  92. package/dist/web/api.d.ts.map +1 -1
  93. package/dist/web/api.js +207 -95
  94. package/dist/web/api.js.map +1 -1
  95. package/dist/web/ui.d.ts.map +1 -1
  96. package/dist/web/ui.js +506 -109
  97. package/dist/web/ui.js.map +1 -1
  98. package/migrations/000_fresh_schema.sql +227 -9
  99. package/migrations/admin/006_admin_setup_tokens.sql +91 -91
  100. package/migrations/admin/007_admin_role_inheritance.sql +32 -0
  101. package/migrations/admin/008_admin_rebac_definitions.sql +117 -0
  102. package/migrations/admin/009_optimize_admin_audit_indexes.sql +15 -0
  103. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/web/ui.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,UAAU,eAAe,CAC7B,YAAqB,EACrB,UAAoB,EACpB,SAAiB,IAAI,EACrB,eAAuC,EAAE,EACzC,mBAAiC,EAAE;IAEnC,gDAAgD;IAChD,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1E,MAAM,cAAc,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAg7FhC,CAAC;AACT,CAAC"}
@@ -198,6 +198,23 @@ CREATE TABLE "ciba_requests" (
198
198
  FOREIGN KEY (user_id) REFERENCES users_core(id) ON DELETE CASCADE
199
199
  );
200
200
 
201
+ CREATE TABLE client_consent_overrides (
202
+ id TEXT PRIMARY KEY,
203
+ tenant_id TEXT NOT NULL DEFAULT 'default',
204
+ client_id TEXT NOT NULL,
205
+ statement_id TEXT NOT NULL,
206
+ requirement TEXT NOT NULL DEFAULT 'inherit', -- 'required'|'optional'|'hidden'|'inherit'
207
+ min_version TEXT, -- null = use tenant default
208
+ enforcement TEXT, -- null = use tenant default
209
+ conditional_rules_json TEXT, -- null = use tenant default
210
+ display_order INTEGER,
211
+ created_at INTEGER NOT NULL,
212
+ updated_at INTEGER NOT NULL,
213
+ FOREIGN KEY (client_id) REFERENCES oauth_clients(client_id) ON DELETE CASCADE,
214
+ FOREIGN KEY (statement_id) REFERENCES consent_statements(id) ON DELETE CASCADE,
215
+ UNIQUE (tenant_id, client_id, statement_id)
216
+ );
217
+
201
218
  CREATE TABLE compliance_reports (
202
219
  id TEXT PRIMARY KEY,
203
220
  tenant_id TEXT NOT NULL DEFAULT 'default',
@@ -230,6 +247,24 @@ CREATE TABLE consent_history (
230
247
  FOREIGN KEY (user_id) REFERENCES users_core(id) ON DELETE CASCADE
231
248
  );
232
249
 
250
+ CREATE TABLE consent_item_history (
251
+ id TEXT PRIMARY KEY,
252
+ tenant_id TEXT NOT NULL DEFAULT 'default',
253
+ user_id TEXT NOT NULL,
254
+ statement_id TEXT NOT NULL,
255
+ action TEXT NOT NULL, -- 'granted'|'denied'|'withdrawn'|'version_upgraded'|'expired'
256
+ version_before TEXT,
257
+ version_after TEXT,
258
+ status_before TEXT,
259
+ status_after TEXT,
260
+ ip_address_hash TEXT,
261
+ user_agent TEXT,
262
+ client_id TEXT,
263
+ metadata_json TEXT,
264
+ created_at INTEGER NOT NULL,
265
+ FOREIGN KEY (user_id) REFERENCES users_core(id) ON DELETE CASCADE
266
+ );
267
+
233
268
  CREATE TABLE consent_policy_versions (
234
269
  id TEXT PRIMARY KEY,
235
270
  tenant_id TEXT NOT NULL DEFAULT 'default',
@@ -242,6 +277,51 @@ CREATE TABLE consent_policy_versions (
242
277
  UNIQUE (tenant_id, policy_type, version)
243
278
  );
244
279
 
280
+ CREATE TABLE consent_statement_localizations (
281
+ id TEXT PRIMARY KEY,
282
+ tenant_id TEXT NOT NULL DEFAULT 'default',
283
+ version_id TEXT NOT NULL,
284
+ language TEXT NOT NULL, -- BCP 47: 'en', 'ja', 'de'
285
+ title TEXT NOT NULL,
286
+ description TEXT NOT NULL,
287
+ document_url TEXT, -- External document URL (content_type='url')
288
+ inline_content TEXT, -- Inline text (content_type='inline')
289
+ created_at INTEGER NOT NULL,
290
+ updated_at INTEGER NOT NULL,
291
+ FOREIGN KEY (version_id) REFERENCES consent_statement_versions(id) ON DELETE CASCADE,
292
+ UNIQUE (version_id, language)
293
+ );
294
+
295
+ CREATE TABLE consent_statement_versions (
296
+ id TEXT PRIMARY KEY,
297
+ tenant_id TEXT NOT NULL DEFAULT 'default',
298
+ statement_id TEXT NOT NULL,
299
+ version TEXT NOT NULL, -- YYYYMMDD fixed: '20250206'
300
+ content_type TEXT NOT NULL DEFAULT 'url', -- 'url' | 'inline'
301
+ effective_at INTEGER NOT NULL,
302
+ content_hash TEXT, -- SHA-256 integrity hash
303
+ is_current INTEGER NOT NULL DEFAULT 0,
304
+ status TEXT NOT NULL DEFAULT 'draft', -- 'draft'|'active'|'archived'
305
+ created_at INTEGER NOT NULL,
306
+ updated_at INTEGER NOT NULL,
307
+ FOREIGN KEY (statement_id) REFERENCES consent_statements(id) ON DELETE CASCADE,
308
+ UNIQUE (tenant_id, statement_id, version)
309
+ );
310
+
311
+ CREATE TABLE consent_statements (
312
+ id TEXT PRIMARY KEY,
313
+ tenant_id TEXT NOT NULL DEFAULT 'default',
314
+ slug TEXT NOT NULL,
315
+ category TEXT NOT NULL DEFAULT 'custom',
316
+ legal_basis TEXT NOT NULL DEFAULT 'consent',
317
+ processing_purpose TEXT,
318
+ display_order INTEGER NOT NULL DEFAULT 0,
319
+ is_active INTEGER NOT NULL DEFAULT 1,
320
+ created_at INTEGER NOT NULL,
321
+ updated_at INTEGER NOT NULL,
322
+ UNIQUE (tenant_id, slug)
323
+ );
324
+
245
325
  CREATE TABLE credential_configurations (
246
326
  id TEXT PRIMARY KEY,
247
327
  tenant_id TEXT NOT NULL,
@@ -335,10 +415,13 @@ CREATE TABLE did_document_cache (
335
415
  CREATE TABLE external_idp_auth_states (
336
416
  id TEXT PRIMARY KEY,
337
417
  tenant_id TEXT NOT NULL DEFAULT 'default',
418
+ client_id TEXT, -- Client ID from the original auth request
338
419
  provider_id TEXT NOT NULL, -- References upstream_providers(id)
339
420
  state TEXT UNIQUE NOT NULL, -- OAuth state parameter
340
421
  nonce TEXT, -- OIDC nonce for ID token validation
341
- code_verifier TEXT, -- PKCE code verifier
422
+ code_verifier TEXT, -- PKCE code verifier for Authrim ↔ External IdP
423
+ code_challenge TEXT, -- PKCE code challenge from client ↔ Authrim
424
+ flow_id TEXT, -- Flow ID for diagnostic logging correlation
342
425
  redirect_uri TEXT NOT NULL, -- Where to redirect after auth
343
426
 
344
427
  -- For linking flow
@@ -352,6 +435,10 @@ CREATE TABLE external_idp_auth_states (
352
435
  max_age INTEGER, -- max_age parameter for auth_time validation
353
436
  acr_values TEXT, -- acr_values parameter for acr validation
354
437
 
438
+ -- Silent Auth & SSO control (Phase 1 & 2)
439
+ prompt TEXT, -- OIDC prompt parameter (none, login, consent, select_account)
440
+ enable_sso INTEGER NOT NULL DEFAULT 1, -- 1 = SSO enabled (handoff), 0 = SSO disabled (Direct Auth)
441
+
355
442
  -- Timestamps
356
443
  expires_at INTEGER NOT NULL,
357
444
  created_at INTEGER NOT NULL,
@@ -504,7 +591,7 @@ CREATE TABLE oauth_clients (
504
591
  default_audience TEXT, -- Default audience for Client Credentials
505
592
  created_at INTEGER NOT NULL,
506
593
  updated_at INTEGER NOT NULL
507
- , is_trusted INTEGER DEFAULT 0, skip_consent INTEGER DEFAULT 0, allow_claims_without_scope INTEGER DEFAULT 0, backchannel_token_delivery_mode TEXT, backchannel_client_notification_endpoint TEXT, backchannel_authentication_request_signing_alg TEXT, backchannel_user_code_parameter INTEGER DEFAULT 0, tenant_id TEXT NOT NULL DEFAULT 'default', jwks TEXT, jwks_uri TEXT, userinfo_signed_response_alg TEXT, post_logout_redirect_uris TEXT, allowed_redirect_origins TEXT, backchannel_logout_uri TEXT, backchannel_logout_session_required INTEGER DEFAULT 0, frontchannel_logout_uri TEXT, frontchannel_logout_session_required INTEGER DEFAULT 0, logout_webhook_uri TEXT, logout_webhook_secret_encrypted TEXT, registration_access_token_hash TEXT, initiate_login_uri TEXT, id_token_signed_response_alg TEXT, request_object_signing_alg TEXT, client_secret_hash TEXT, software_id TEXT, software_version TEXT, requestable_scopes TEXT, require_pkce INTEGER DEFAULT 0);
594
+ , is_trusted INTEGER DEFAULT 0, skip_consent INTEGER DEFAULT 0, allow_claims_without_scope INTEGER DEFAULT 0, backchannel_token_delivery_mode TEXT, backchannel_client_notification_endpoint TEXT, backchannel_authentication_request_signing_alg TEXT, backchannel_user_code_parameter INTEGER DEFAULT 0, tenant_id TEXT NOT NULL DEFAULT 'default', jwks TEXT, jwks_uri TEXT, userinfo_signed_response_alg TEXT, post_logout_redirect_uris TEXT, allowed_redirect_origins TEXT, backchannel_logout_uri TEXT, backchannel_logout_session_required INTEGER DEFAULT 0, frontchannel_logout_uri TEXT, frontchannel_logout_session_required INTEGER DEFAULT 0, logout_webhook_uri TEXT, logout_webhook_secret_encrypted TEXT, registration_access_token_hash TEXT, initiate_login_uri TEXT, login_ui_url TEXT, id_token_signed_response_alg TEXT, request_object_signing_alg TEXT, client_secret_hash TEXT, software_id TEXT, software_version TEXT, requestable_scopes TEXT, require_pkce INTEGER DEFAULT 0);
508
595
 
509
596
  CREATE TABLE operational_logs (
510
597
  id TEXT PRIMARY KEY,
@@ -1093,6 +1180,23 @@ CREATE TABLE suspicious_activities (
1093
1180
  resolved_at TEXT -- When resolved/dismissed
1094
1181
  );
1095
1182
 
1183
+ CREATE TABLE tenant_consent_requirements (
1184
+ id TEXT PRIMARY KEY,
1185
+ tenant_id TEXT NOT NULL DEFAULT 'default',
1186
+ statement_id TEXT NOT NULL,
1187
+ is_required INTEGER NOT NULL DEFAULT 0,
1188
+ min_version TEXT,
1189
+ enforcement TEXT NOT NULL DEFAULT 'block',
1190
+ show_deletion_link INTEGER NOT NULL DEFAULT 0,
1191
+ deletion_url TEXT,
1192
+ conditional_rules_json TEXT,
1193
+ display_order INTEGER NOT NULL DEFAULT 0,
1194
+ created_at INTEGER NOT NULL,
1195
+ updated_at INTEGER NOT NULL,
1196
+ FOREIGN KEY (statement_id) REFERENCES consent_statements(id) ON DELETE CASCADE,
1197
+ UNIQUE (tenant_id, statement_id)
1198
+ );
1199
+
1096
1200
  CREATE TABLE token_claim_rules (
1097
1201
  -- Primary key
1098
1202
  id TEXT PRIMARY KEY,
@@ -1194,7 +1298,30 @@ CREATE TABLE upstream_providers (
1194
1298
  -- Metadata
1195
1299
  created_at INTEGER NOT NULL,
1196
1300
  updated_at INTEGER NOT NULL
1197
- , slug TEXT, token_endpoint_auth_method TEXT DEFAULT 'client_secret_post', always_fetch_userinfo INTEGER DEFAULT 0, use_request_object INTEGER DEFAULT 0, request_object_signing_alg TEXT, private_key_jwk_encrypted TEXT, public_key_jwk TEXT);
1301
+ , slug TEXT, token_endpoint_auth_method TEXT DEFAULT 'client_secret_post', always_fetch_userinfo INTEGER DEFAULT 0, enable_sso INTEGER NOT NULL DEFAULT 1, use_request_object INTEGER DEFAULT 0, request_object_signing_alg TEXT, private_key_jwk_encrypted TEXT, public_key_jwk TEXT);
1302
+
1303
+ CREATE TABLE user_consent_records (
1304
+ id TEXT PRIMARY KEY,
1305
+ tenant_id TEXT NOT NULL DEFAULT 'default',
1306
+ user_id TEXT NOT NULL,
1307
+ statement_id TEXT NOT NULL,
1308
+ version_id TEXT NOT NULL,
1309
+ version TEXT NOT NULL,
1310
+ status TEXT NOT NULL DEFAULT 'granted',
1311
+ granted_at INTEGER,
1312
+ withdrawn_at INTEGER,
1313
+ expires_at INTEGER,
1314
+ client_id TEXT,
1315
+ ip_address_hash TEXT,
1316
+ user_agent TEXT,
1317
+ receipt_id TEXT,
1318
+ created_at INTEGER NOT NULL,
1319
+ updated_at INTEGER NOT NULL,
1320
+ FOREIGN KEY (user_id) REFERENCES users_core(id) ON DELETE CASCADE,
1321
+ FOREIGN KEY (statement_id) REFERENCES consent_statements(id),
1322
+ FOREIGN KEY (version_id) REFERENCES consent_statement_versions(id),
1323
+ UNIQUE (tenant_id, user_id, statement_id)
1324
+ );
1198
1325
 
1199
1326
  CREATE TABLE "user_custom_fields" (
1200
1327
  user_id TEXT NOT NULL,
@@ -1475,8 +1602,6 @@ CREATE INDEX idx_audit_log_created_at ON audit_log(created_at);
1475
1602
 
1476
1603
  CREATE INDEX idx_audit_log_resource ON audit_log(resource_type, resource_id);
1477
1604
 
1478
- CREATE INDEX idx_audit_log_severity ON audit_log(severity);
1479
-
1480
1605
  CREATE INDEX idx_audit_log_tenant_id ON audit_log(tenant_id);
1481
1606
 
1482
1607
  CREATE INDEX idx_audit_log_user_id ON audit_log(user_id);
@@ -1529,6 +1654,14 @@ CREATE INDEX idx_compliance_reports_tenant ON compliance_reports(tenant_id);
1529
1654
 
1530
1655
  CREATE INDEX idx_compliance_reports_type ON compliance_reports(tenant_id, type);
1531
1656
 
1657
+ CREATE INDEX idx_cco_client ON client_consent_overrides(tenant_id, client_id);
1658
+
1659
+ CREATE INDEX idx_cih_statement ON consent_item_history(statement_id, created_at);
1660
+
1661
+ CREATE INDEX idx_cih_tenant ON consent_item_history(tenant_id, created_at);
1662
+
1663
+ CREATE INDEX idx_cih_user ON consent_item_history(user_id, created_at);
1664
+
1532
1665
  CREATE INDEX idx_consent_history_action
1533
1666
  ON consent_history(action, created_at);
1534
1667
 
@@ -1547,6 +1680,16 @@ CREATE INDEX idx_consent_policy_versions_effective
1547
1680
  CREATE INDEX idx_consent_policy_versions_tenant
1548
1681
  ON consent_policy_versions(tenant_id, policy_type);
1549
1682
 
1683
+ CREATE INDEX idx_consent_statements_tenant ON consent_statements(tenant_id, is_active);
1684
+
1685
+ CREATE INDEX idx_csl_version ON consent_statement_localizations(version_id, language);
1686
+
1687
+ CREATE INDEX idx_csv_effective ON consent_statement_versions(effective_at);
1688
+
1689
+ CREATE INDEX idx_csv_statement ON consent_statement_versions(statement_id, is_current);
1690
+
1691
+ CREATE UNIQUE INDEX idx_csv_unique_current ON consent_statement_versions(tenant_id, statement_id) WHERE is_current = 1;
1692
+
1550
1693
  CREATE INDEX idx_consents_client ON oauth_client_consents(client_id);
1551
1694
 
1552
1695
  CREATE INDEX idx_consents_expires_at_active
@@ -1859,6 +2002,8 @@ CREATE INDEX idx_suspicious_activities_type ON suspicious_activities(tenant_id,
1859
2002
 
1860
2003
  CREATE INDEX idx_suspicious_activities_user ON suspicious_activities(tenant_id, user_id);
1861
2004
 
2005
+ CREATE INDEX idx_tcr_tenant ON tenant_consent_requirements(tenant_id);
2006
+
1862
2007
  CREATE INDEX idx_tcr_evaluation ON token_claim_rules(
1863
2008
  tenant_id,
1864
2009
  token_type,
@@ -1888,16 +2033,23 @@ CREATE UNIQUE INDEX idx_upstream_providers_tenant_slug
1888
2033
  ON upstream_providers(tenant_id, slug)
1889
2034
  WHERE slug IS NOT NULL;
1890
2035
 
2036
+ CREATE INDEX idx_upstream_providers_enable_sso
2037
+ ON upstream_providers(tenant_id, enable_sso);
2038
+
2039
+ CREATE INDEX idx_ucr_expires ON user_consent_records(expires_at) WHERE expires_at IS NOT NULL;
2040
+
2041
+ CREATE INDEX idx_ucr_statement ON user_consent_records(tenant_id, statement_id);
2042
+
2043
+ CREATE INDEX idx_ucr_status ON user_consent_records(status);
2044
+
2045
+ CREATE INDEX idx_ucr_user ON user_consent_records(tenant_id, user_id);
2046
+
1891
2047
  CREATE INDEX idx_user_verified_attributes_name ON user_verified_attributes(tenant_id, attribute_name);
1892
2048
 
1893
2049
  CREATE INDEX idx_user_verified_attributes_user ON user_verified_attributes(tenant_id, user_id);
1894
2050
 
1895
- CREATE INDEX idx_users_core_active ON users_core(is_active);
1896
-
1897
2051
  CREATE INDEX idx_users_core_email_domain ON users_core(email_domain_hash);
1898
2052
 
1899
- CREATE INDEX idx_users_core_hash_version ON users_core(email_domain_hash_version);
1900
-
1901
2053
  CREATE INDEX idx_users_core_partition ON users_core(pii_partition);
1902
2054
 
1903
2055
  CREATE INDEX idx_users_core_pii_status ON users_core(pii_status);
@@ -1965,3 +2117,69 @@ CREATE INDEX idx_ws_subs_connection
1965
2117
  CREATE INDEX idx_ws_subs_subject
1966
2118
  ON websocket_subscriptions(subject_id, is_active);
1967
2119
 
2120
+
2121
+ -- =============================================================================
2122
+ -- From 053: Custom Claim Schemas (with registration form fields from 060)
2123
+ -- =============================================================================
2124
+
2125
+ CREATE TABLE custom_claim_schemas (
2126
+ id TEXT PRIMARY KEY,
2127
+ tenant_id TEXT NOT NULL DEFAULT 'default',
2128
+ field_key TEXT NOT NULL,
2129
+ display_label TEXT NOT NULL,
2130
+ field_type TEXT NOT NULL DEFAULT 'string',
2131
+ is_pii INTEGER NOT NULL DEFAULT 0,
2132
+ is_required INTEGER NOT NULL DEFAULT 0,
2133
+ is_active INTEGER NOT NULL DEFAULT 1,
2134
+ validation_rules TEXT CHECK(validation_rules IS NULL OR json_valid(validation_rules)),
2135
+ include_in_id_token INTEGER NOT NULL DEFAULT 0,
2136
+ include_in_userinfo INTEGER NOT NULL DEFAULT 0,
2137
+ include_in_introspection INTEGER NOT NULL DEFAULT 0,
2138
+ required_scopes TEXT CHECK(required_scopes IS NULL OR json_valid(required_scopes)),
2139
+ scope_mode TEXT NOT NULL DEFAULT 'any' CHECK(scope_mode IN ('all', 'any')),
2140
+ is_searchable INTEGER NOT NULL DEFAULT 1,
2141
+ is_exportable INTEGER NOT NULL DEFAULT 1,
2142
+ is_vc_claim INTEGER NOT NULL DEFAULT 0,
2143
+ claim_namespace TEXT,
2144
+ description TEXT,
2145
+ display_order INTEGER NOT NULL DEFAULT 0,
2146
+ schema_version INTEGER NOT NULL DEFAULT 1,
2147
+ operation_status TEXT NOT NULL DEFAULT 'active',
2148
+ operation_detail TEXT,
2149
+ is_system INTEGER NOT NULL DEFAULT 0,
2150
+ created_by TEXT,
2151
+ created_at INTEGER NOT NULL,
2152
+ updated_at INTEGER NOT NULL,
2153
+ show_on_registration INTEGER NOT NULL DEFAULT 0,
2154
+ registration_required INTEGER NOT NULL DEFAULT 0,
2155
+ registration_order INTEGER NOT NULL DEFAULT 0,
2156
+ registration_placeholder TEXT
2157
+ );
2158
+
2159
+ CREATE UNIQUE INDEX uniq_ccs_active_key ON custom_claim_schemas(tenant_id, field_key) WHERE is_active = 1;
2160
+ CREATE INDEX idx_ccs_tenant_active ON custom_claim_schemas(tenant_id, is_active, display_order);
2161
+ CREATE INDEX idx_ccs_tenant_key ON custom_claim_schemas(tenant_id, field_key);
2162
+ CREATE INDEX idx_ccs_operation ON custom_claim_schemas(operation_status) WHERE operation_status != 'active';
2163
+
2164
+ -- =============================================================================
2165
+ -- From 059: Tenant Invitations
2166
+ -- =============================================================================
2167
+
2168
+ CREATE TABLE tenant_invitations (
2169
+ id TEXT PRIMARY KEY,
2170
+ token TEXT NOT NULL UNIQUE,
2171
+ tenant_id TEXT NOT NULL DEFAULT 'default',
2172
+ invited_email TEXT,
2173
+ invited_by TEXT NOT NULL,
2174
+ role_id TEXT,
2175
+ org_id TEXT,
2176
+ max_uses INTEGER NOT NULL DEFAULT 1,
2177
+ use_count INTEGER NOT NULL DEFAULT 0,
2178
+ expires_at INTEGER NOT NULL,
2179
+ created_at INTEGER NOT NULL,
2180
+ updated_at INTEGER NOT NULL
2181
+ );
2182
+
2183
+ CREATE INDEX idx_ti_token ON tenant_invitations(token)
2184
+ WHERE expires_at > unixepoch();
2185
+ CREATE INDEX idx_ti_tenant ON tenant_invitations(tenant_id, created_at DESC);
@@ -1,91 +1,91 @@
1
- -- =============================================================================
2
- -- Migration: Admin Setup Tokens (D1_ADMIN)
3
- -- =============================================================================
4
- -- Created: 2025-01-25
5
- -- Description: Creates admin_setup_tokens table for secure Admin UI passkey
6
- -- registration during initial setup.
7
- --
8
- -- IMPORTANT: This migration is for D1_ADMIN (dedicated Admin database).
9
- --
10
- -- Use Case:
11
- -- - After initial setup on Router, redirect to Admin UI with a setup token
12
- -- - Admin UI verifies the token and allows passkey registration
13
- -- - Token is single-use and time-limited for security
14
- -- =============================================================================
15
-
16
- -- =============================================================================
17
- -- admin_setup_tokens Table
18
- -- =============================================================================
19
- -- Stores one-time setup tokens for Admin UI passkey registration.
20
- -- These tokens allow secure passkey registration after initial setup.
21
- --
22
- -- Lifecycle:
23
- -- 1. Created during initial setup (or via CLI for recovery)
24
- -- 2. Used when admin visits Admin UI /setup/complete?token=xxx
25
- -- 3. Invalidated after successful passkey registration
26
- -- 4. Auto-expires after 24 hours
27
- -- =============================================================================
28
-
29
- CREATE TABLE IF NOT EXISTS admin_setup_tokens (
30
- -- Token ID (the actual token value, UUID v4)
31
- id TEXT PRIMARY KEY,
32
-
33
- -- Multi-tenant support
34
- tenant_id TEXT NOT NULL DEFAULT 'default',
35
-
36
- -- Reference to admin user
37
- admin_user_id TEXT NOT NULL REFERENCES admin_users(id) ON DELETE CASCADE,
38
-
39
- -- Token status
40
- -- pending: Created, waiting for use
41
- -- used: Successfully used for passkey registration
42
- -- expired: Expired without use
43
- -- revoked: Manually revoked
44
- status TEXT NOT NULL DEFAULT 'pending',
45
-
46
- -- Expiration (UNIX timestamp in milliseconds)
47
- expires_at INTEGER NOT NULL,
48
-
49
- -- Usage tracking
50
- used_at INTEGER, -- When the token was used
51
- used_ip TEXT, -- IP address that used the token
52
-
53
- -- Audit fields
54
- created_at INTEGER NOT NULL,
55
- created_by TEXT -- 'initial_setup' | 'cli' | admin_user_id
56
- );
57
-
58
- -- =============================================================================
59
- -- Indexes for admin_setup_tokens
60
- -- =============================================================================
61
-
62
- -- User's tokens lookup (for checking existing tokens)
63
- CREATE INDEX IF NOT EXISTS idx_admin_setup_tokens_user ON admin_setup_tokens(admin_user_id);
64
-
65
- -- Tenant-scoped lookup
66
- CREATE INDEX IF NOT EXISTS idx_admin_setup_tokens_tenant ON admin_setup_tokens(tenant_id);
67
-
68
- -- Status filter (for cleanup jobs)
69
- CREATE INDEX IF NOT EXISTS idx_admin_setup_tokens_status ON admin_setup_tokens(status);
70
-
71
- -- Expiration lookup (for cleanup jobs)
72
- CREATE INDEX IF NOT EXISTS idx_admin_setup_tokens_expires ON admin_setup_tokens(expires_at);
73
-
74
- -- =============================================================================
75
- -- admin_users: Add passkey_setup_completed column
76
- -- =============================================================================
77
- -- Track whether the admin user has completed passkey setup on Admin UI.
78
- -- This is separate from having passkeys - it tracks the initial setup flow.
79
- -- =============================================================================
80
-
81
- ALTER TABLE admin_users ADD COLUMN passkey_setup_completed INTEGER DEFAULT 0;
82
-
83
- -- =============================================================================
84
- -- Migration Complete
85
- -- =============================================================================
86
- -- Usage:
87
- -- 1. Router creates token during initial setup
88
- -- 2. Admin visits Admin UI with token
89
- -- 3. Admin UI verifies token and registers passkey
90
- -- 4. Token is marked as 'used' and passkey_setup_completed is set to 1
91
- -- =============================================================================
1
+ -- =============================================================================
2
+ -- Migration: Admin Setup Tokens (D1_ADMIN)
3
+ -- =============================================================================
4
+ -- Created: 2025-01-25
5
+ -- Description: Creates admin_setup_tokens table for secure Admin UI passkey
6
+ -- registration during initial setup.
7
+ --
8
+ -- IMPORTANT: This migration is for D1_ADMIN (dedicated Admin database).
9
+ --
10
+ -- Use Case:
11
+ -- - After initial setup on Router, redirect to Admin UI with a setup token
12
+ -- - Admin UI verifies the token and allows passkey registration
13
+ -- - Token is single-use and time-limited for security
14
+ -- =============================================================================
15
+
16
+ -- =============================================================================
17
+ -- admin_setup_tokens Table
18
+ -- =============================================================================
19
+ -- Stores one-time setup tokens for Admin UI passkey registration.
20
+ -- These tokens allow secure passkey registration after initial setup.
21
+ --
22
+ -- Lifecycle:
23
+ -- 1. Created during initial setup (or via CLI for recovery)
24
+ -- 2. Used when admin visits Admin UI /setup/complete?token=xxx
25
+ -- 3. Invalidated after successful passkey registration
26
+ -- 4. Auto-expires after 24 hours
27
+ -- =============================================================================
28
+
29
+ CREATE TABLE IF NOT EXISTS admin_setup_tokens (
30
+ -- Token ID (the actual token value, UUID v4)
31
+ id TEXT PRIMARY KEY,
32
+
33
+ -- Multi-tenant support
34
+ tenant_id TEXT NOT NULL DEFAULT 'default',
35
+
36
+ -- Reference to admin user
37
+ admin_user_id TEXT NOT NULL REFERENCES admin_users(id) ON DELETE CASCADE,
38
+
39
+ -- Token status
40
+ -- pending: Created, waiting for use
41
+ -- used: Successfully used for passkey registration
42
+ -- expired: Expired without use
43
+ -- revoked: Manually revoked
44
+ status TEXT NOT NULL DEFAULT 'pending',
45
+
46
+ -- Expiration (UNIX timestamp in milliseconds)
47
+ expires_at INTEGER NOT NULL,
48
+
49
+ -- Usage tracking
50
+ used_at INTEGER, -- When the token was used
51
+ used_ip TEXT, -- IP address that used the token
52
+
53
+ -- Audit fields
54
+ created_at INTEGER NOT NULL,
55
+ created_by TEXT -- 'initial_setup' | 'cli' | admin_user_id
56
+ );
57
+
58
+ -- =============================================================================
59
+ -- Indexes for admin_setup_tokens
60
+ -- =============================================================================
61
+
62
+ -- User's tokens lookup (for checking existing tokens)
63
+ CREATE INDEX IF NOT EXISTS idx_admin_setup_tokens_user ON admin_setup_tokens(admin_user_id);
64
+
65
+ -- Tenant-scoped lookup
66
+ CREATE INDEX IF NOT EXISTS idx_admin_setup_tokens_tenant ON admin_setup_tokens(tenant_id);
67
+
68
+ -- Status filter (for cleanup jobs)
69
+ CREATE INDEX IF NOT EXISTS idx_admin_setup_tokens_status ON admin_setup_tokens(status);
70
+
71
+ -- Expiration lookup (for cleanup jobs)
72
+ CREATE INDEX IF NOT EXISTS idx_admin_setup_tokens_expires ON admin_setup_tokens(expires_at);
73
+
74
+ -- =============================================================================
75
+ -- admin_users: Add passkey_setup_completed column
76
+ -- =============================================================================
77
+ -- Track whether the admin user has completed passkey setup on Admin UI.
78
+ -- This is separate from having passkeys - it tracks the initial setup flow.
79
+ -- =============================================================================
80
+
81
+ ALTER TABLE admin_users ADD COLUMN passkey_setup_completed INTEGER DEFAULT 0;
82
+
83
+ -- =============================================================================
84
+ -- Migration Complete
85
+ -- =============================================================================
86
+ -- Usage:
87
+ -- 1. Router creates token during initial setup
88
+ -- 2. Admin visits Admin UI with token
89
+ -- 3. Admin UI verifies token and registers passkey
90
+ -- 4. Token is marked as 'used' and passkey_setup_completed is set to 1
91
+ -- =============================================================================
@@ -0,0 +1,32 @@
1
+ -- =============================================================================
2
+ -- Migration: Admin Role Inheritance (D1_ADMIN)
3
+ -- =============================================================================
4
+ -- Created: 2026-02-06
5
+ -- Description: Adds role inheritance support to admin_roles table.
6
+ -- Allows roles to inherit permissions from parent roles.
7
+ --
8
+ -- Changes:
9
+ -- - Add inherits_from column to admin_roles table
10
+ -- - Add index for inheritance lookup
11
+ -- =============================================================================
12
+
13
+ -- =============================================================================
14
+ -- Add inherits_from column to admin_roles
15
+ -- =============================================================================
16
+
17
+ -- Add inherits_from column (nullable, references another role)
18
+ ALTER TABLE admin_roles ADD COLUMN inherits_from TEXT DEFAULT NULL;
19
+
20
+ -- Create index for inheritance lookup
21
+ CREATE INDEX IF NOT EXISTS idx_admin_roles_inherits ON admin_roles(inherits_from);
22
+
23
+ -- =============================================================================
24
+ -- Migration Complete
25
+ -- =============================================================================
26
+ --
27
+ -- admin_roles table now supports role inheritance:
28
+ -- - inherits_from: ID of parent role (NULL if no inheritance)
29
+ -- - Permissions are merged: child role permissions + parent role permissions
30
+ -- - Inheritance chain can be resolved recursively
31
+ --
32
+ -- =============================================================================