hazo_auth 7.0.1 → 8.0.1

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 (274) hide show
  1. package/README.md +96 -319
  2. package/SETUP_CHECKLIST.md +59 -248
  3. package/cli-src/cli/generate.ts +1 -10
  4. package/cli-src/cli/validate.ts +0 -4
  5. package/cli-src/lib/auth/auth_types.ts +15 -21
  6. package/cli-src/lib/auth/hazo_get_auth.server.ts +19 -0
  7. package/cli-src/lib/auth/hazo_get_tenant_auth.server.ts +24 -25
  8. package/cli-src/lib/auth/index.ts +2 -2
  9. package/cli-src/lib/auth/nextauth_config.ts +27 -67
  10. package/cli-src/lib/auth/with_auth.server.ts +15 -15
  11. package/cli-src/lib/config/default_config.ts +8 -0
  12. package/cli-src/lib/cookies_config.server.ts +1 -1
  13. package/cli-src/lib/email_verification_config.server.ts +34 -0
  14. package/cli-src/lib/forgot_password_config.server.ts +34 -0
  15. package/cli-src/lib/legal/legal_docs_config.server.ts +61 -0
  16. package/cli-src/lib/legal/legal_docs_reader.server.ts +36 -0
  17. package/cli-src/lib/legal/legal_docs_service.ts +196 -0
  18. package/cli-src/lib/legal/legal_docs_types.ts +31 -0
  19. package/cli-src/lib/login_config.server.ts +29 -14
  20. package/cli-src/lib/my_settings_config.server.ts +3 -0
  21. package/cli-src/lib/oauth_config.server.ts +31 -57
  22. package/cli-src/lib/register_config.server.ts +35 -11
  23. package/cli-src/lib/reset_password_config.server.ts +31 -0
  24. package/cli-src/lib/services/email_template_manifest.ts +0 -17
  25. package/cli-src/lib/services/index.ts +2 -8
  26. package/cli-src/lib/services/oauth_service.ts +74 -128
  27. package/cli-src/lib/services/otp_service.ts +7 -2
  28. package/cli-src/lib/services/registration_service.ts +16 -1
  29. package/cli-src/lib/services/session_token_service.ts +0 -2
  30. package/config/hazo_auth_config.example.ini +41 -76
  31. package/dist/cli/generate.d.ts.map +1 -1
  32. package/dist/cli/generate.js +1 -10
  33. package/dist/cli/validate.d.ts.map +1 -1
  34. package/dist/cli/validate.js +0 -4
  35. package/dist/client.d.ts +1 -2
  36. package/dist/client.d.ts.map +1 -1
  37. package/dist/client.js +3 -1
  38. package/dist/components/layouts/create_firm/index.d.ts +8 -4
  39. package/dist/components/layouts/create_firm/index.d.ts.map +1 -1
  40. package/dist/components/layouts/create_firm/index.js +3 -3
  41. package/dist/components/layouts/email_verification/index.d.ts +5 -4
  42. package/dist/components/layouts/email_verification/index.d.ts.map +1 -1
  43. package/dist/components/layouts/email_verification/index.js +4 -4
  44. package/dist/components/layouts/forgot_password/index.d.ts +5 -4
  45. package/dist/components/layouts/forgot_password/index.d.ts.map +1 -1
  46. package/dist/components/layouts/forgot_password/index.js +2 -2
  47. package/dist/components/layouts/index.d.ts +1 -0
  48. package/dist/components/layouts/index.d.ts.map +1 -1
  49. package/dist/components/layouts/index.js +2 -0
  50. package/dist/components/layouts/legal/index.d.ts +5 -0
  51. package/dist/components/layouts/legal/index.d.ts.map +1 -0
  52. package/dist/components/layouts/legal/index.js +4 -0
  53. package/dist/components/layouts/legal/legal_acceptance_gate.d.ts +7 -0
  54. package/dist/components/layouts/legal/legal_acceptance_gate.d.ts.map +1 -0
  55. package/dist/components/layouts/legal/legal_acceptance_gate.js +84 -0
  56. package/dist/components/layouts/legal/legal_doc_checkbox_list.d.ts +9 -0
  57. package/dist/components/layouts/legal/legal_doc_checkbox_list.d.ts.map +1 -0
  58. package/dist/components/layouts/legal/legal_doc_checkbox_list.js +11 -0
  59. package/dist/components/layouts/legal/legal_doc_combined_view.d.ts +9 -0
  60. package/dist/components/layouts/legal/legal_doc_combined_view.d.ts.map +1 -0
  61. package/dist/components/layouts/legal/legal_doc_combined_view.js +11 -0
  62. package/dist/components/layouts/legal/legal_doc_drawer.d.ts +8 -0
  63. package/dist/components/layouts/legal/legal_doc_drawer.d.ts.map +1 -0
  64. package/dist/components/layouts/legal/legal_doc_drawer.js +55 -0
  65. package/dist/components/layouts/login/index.d.ts +13 -19
  66. package/dist/components/layouts/login/index.d.ts.map +1 -1
  67. package/dist/components/layouts/login/index.js +8 -11
  68. package/dist/components/layouts/otp/index.d.ts +5 -1
  69. package/dist/components/layouts/otp/index.d.ts.map +1 -1
  70. package/dist/components/layouts/otp/index.js +2 -2
  71. package/dist/components/layouts/register/hooks/use_register_form.d.ts +5 -1
  72. package/dist/components/layouts/register/hooks/use_register_form.d.ts.map +1 -1
  73. package/dist/components/layouts/register/hooks/use_register_form.js +25 -10
  74. package/dist/components/layouts/register/index.d.ts +11 -11
  75. package/dist/components/layouts/register/index.d.ts.map +1 -1
  76. package/dist/components/layouts/register/index.js +26 -7
  77. package/dist/components/layouts/reset_password/index.d.ts +5 -4
  78. package/dist/components/layouts/reset_password/index.d.ts.map +1 -1
  79. package/dist/components/layouts/reset_password/index.js +5 -5
  80. package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts +5 -3
  81. package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts.map +1 -1
  82. package/dist/components/layouts/shared/components/already_logged_in_guard.js +2 -2
  83. package/dist/components/layouts/shared/components/facebook_sign_in_button.d.ts +2 -6
  84. package/dist/components/layouts/shared/components/facebook_sign_in_button.d.ts.map +1 -1
  85. package/dist/components/layouts/shared/components/facebook_sign_in_button.js +11 -13
  86. package/dist/components/layouts/shared/components/sidebar_layout_wrapper.d.ts.map +1 -1
  87. package/dist/components/layouts/shared/components/sidebar_layout_wrapper.js +3 -8
  88. package/dist/components/layouts/shared/components/two_column_auth_layout.d.ts +6 -3
  89. package/dist/components/layouts/shared/components/two_column_auth_layout.d.ts.map +1 -1
  90. package/dist/components/layouts/shared/components/two_column_auth_layout.js +5 -8
  91. package/dist/components/layouts/shared/index.d.ts +2 -0
  92. package/dist/components/layouts/shared/index.d.ts.map +1 -1
  93. package/dist/components/layouts/shared/index.js +1 -0
  94. package/dist/components/layouts/user_management/index.d.ts.map +1 -1
  95. package/dist/components/layouts/user_management/index.js +84 -9
  96. package/dist/components/ui/button.d.ts +1 -1
  97. package/dist/components/ui/input-otp.d.ts +2 -2
  98. package/dist/components/ui/sheet.d.ts +1 -1
  99. package/dist/index.d.ts +2 -1
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/lib/auth/auth_types.d.ts +14 -13
  102. package/dist/lib/auth/auth_types.d.ts.map +1 -1
  103. package/dist/lib/auth/auth_types.js +0 -10
  104. package/dist/lib/auth/hazo_get_auth.server.d.ts.map +1 -1
  105. package/dist/lib/auth/hazo_get_auth.server.js +19 -0
  106. package/dist/lib/auth/hazo_get_tenant_auth.server.d.ts +7 -8
  107. package/dist/lib/auth/hazo_get_tenant_auth.server.d.ts.map +1 -1
  108. package/dist/lib/auth/hazo_get_tenant_auth.server.js +22 -23
  109. package/dist/lib/auth/index.d.ts +2 -2
  110. package/dist/lib/auth/index.d.ts.map +1 -1
  111. package/dist/lib/auth/nextauth_config.d.ts +0 -10
  112. package/dist/lib/auth/nextauth_config.d.ts.map +1 -1
  113. package/dist/lib/auth/nextauth_config.js +23 -52
  114. package/dist/lib/auth/with_auth.server.d.ts +13 -13
  115. package/dist/lib/auth/with_auth.server.d.ts.map +1 -1
  116. package/dist/lib/auth/with_auth.server.js +2 -2
  117. package/dist/lib/config/default_config.d.ts +16 -0
  118. package/dist/lib/config/default_config.d.ts.map +1 -1
  119. package/dist/lib/config/default_config.js +8 -0
  120. package/dist/lib/cookies_config.server.d.ts +1 -1
  121. package/dist/lib/cookies_config.server.js +1 -1
  122. package/dist/lib/email_verification_config.server.d.ts +3 -0
  123. package/dist/lib/email_verification_config.server.d.ts.map +1 -1
  124. package/dist/lib/email_verification_config.server.js +15 -0
  125. package/dist/lib/forgot_password_config.server.d.ts +3 -0
  126. package/dist/lib/forgot_password_config.server.d.ts.map +1 -1
  127. package/dist/lib/forgot_password_config.server.js +15 -0
  128. package/dist/lib/legal/legal_docs_config.server.d.ts +22 -0
  129. package/dist/lib/legal/legal_docs_config.server.d.ts.map +1 -0
  130. package/dist/lib/legal/legal_docs_config.server.js +52 -0
  131. package/dist/lib/legal/legal_docs_reader.server.d.ts +15 -0
  132. package/dist/lib/legal/legal_docs_reader.server.d.ts.map +1 -0
  133. package/dist/lib/legal/legal_docs_reader.server.js +24 -0
  134. package/dist/lib/legal/legal_docs_service.d.ts +49 -0
  135. package/dist/lib/legal/legal_docs_service.d.ts.map +1 -0
  136. package/dist/lib/legal/legal_docs_service.js +140 -0
  137. package/dist/lib/legal/legal_docs_types.d.ts +25 -0
  138. package/dist/lib/legal/legal_docs_types.d.ts.map +1 -0
  139. package/dist/lib/legal/legal_docs_types.js +2 -0
  140. package/dist/lib/login_config.server.d.ts +3 -6
  141. package/dist/lib/login_config.server.d.ts.map +1 -1
  142. package/dist/lib/login_config.server.js +11 -7
  143. package/dist/lib/my_settings_config.server.d.ts +1 -0
  144. package/dist/lib/my_settings_config.server.d.ts.map +1 -1
  145. package/dist/lib/my_settings_config.server.js +2 -0
  146. package/dist/lib/oauth_config.server.d.ts +8 -17
  147. package/dist/lib/oauth_config.server.d.ts.map +1 -1
  148. package/dist/lib/oauth_config.server.js +10 -25
  149. package/dist/lib/register_config.server.d.ts +5 -2
  150. package/dist/lib/register_config.server.d.ts.map +1 -1
  151. package/dist/lib/register_config.server.js +15 -4
  152. package/dist/lib/reset_password_config.server.d.ts +3 -0
  153. package/dist/lib/reset_password_config.server.d.ts.map +1 -1
  154. package/dist/lib/reset_password_config.server.js +13 -0
  155. package/dist/lib/services/email_template_manifest.d.ts.map +1 -1
  156. package/dist/lib/services/email_template_manifest.js +0 -17
  157. package/dist/lib/services/index.d.ts +0 -2
  158. package/dist/lib/services/index.d.ts.map +1 -1
  159. package/dist/lib/services/index.js +0 -1
  160. package/dist/lib/services/oauth_service.d.ts +11 -22
  161. package/dist/lib/services/oauth_service.d.ts.map +1 -1
  162. package/dist/lib/services/oauth_service.js +63 -96
  163. package/dist/lib/services/otp_service.d.ts +1 -1
  164. package/dist/lib/services/otp_service.d.ts.map +1 -1
  165. package/dist/lib/services/otp_service.js +6 -1
  166. package/dist/lib/services/registration_service.d.ts +5 -0
  167. package/dist/lib/services/registration_service.d.ts.map +1 -1
  168. package/dist/lib/services/registration_service.js +6 -0
  169. package/dist/lib/services/session_token_service.d.ts +0 -2
  170. package/dist/lib/services/session_token_service.d.ts.map +1 -1
  171. package/dist/lib/services/session_token_service.js +0 -2
  172. package/dist/page_components/create_firm.d.ts +1 -13
  173. package/dist/page_components/create_firm.d.ts.map +1 -1
  174. package/dist/page_components/create_firm.js +6 -10
  175. package/dist/page_components/forgot_password.d.ts +4 -1
  176. package/dist/page_components/forgot_password.d.ts.map +1 -1
  177. package/dist/page_components/forgot_password.js +6 -2
  178. package/dist/page_components/index.d.ts +0 -5
  179. package/dist/page_components/index.d.ts.map +1 -1
  180. package/dist/page_components/index.js +0 -5
  181. package/dist/page_components/login.d.ts +4 -1
  182. package/dist/page_components/login.d.ts.map +1 -1
  183. package/dist/page_components/login.js +6 -2
  184. package/dist/page_components/register.d.ts +4 -1
  185. package/dist/page_components/register.d.ts.map +1 -1
  186. package/dist/page_components/register.js +6 -2
  187. package/dist/page_components/reset_password.d.ts +4 -1
  188. package/dist/page_components/reset_password.d.ts.map +1 -1
  189. package/dist/page_components/reset_password.js +6 -2
  190. package/dist/page_components/verify_email.d.ts +4 -1
  191. package/dist/page_components/verify_email.d.ts.map +1 -1
  192. package/dist/page_components/verify_email.js +6 -2
  193. package/dist/server/routes/assets.d.ts +8 -0
  194. package/dist/server/routes/assets.d.ts.map +1 -0
  195. package/dist/server/routes/assets.js +38 -0
  196. package/dist/server/routes/consent_me.d.ts +4 -0
  197. package/dist/server/routes/consent_me.d.ts.map +1 -0
  198. package/dist/server/routes/consent_me.js +15 -0
  199. package/dist/server/routes/index.d.ts +9 -4
  200. package/dist/server/routes/index.d.ts.map +1 -1
  201. package/dist/server/routes/index.js +13 -5
  202. package/dist/server/routes/legal_docs_accept.d.ts +3 -0
  203. package/dist/server/routes/legal_docs_accept.d.ts.map +1 -0
  204. package/dist/server/routes/legal_docs_accept.js +43 -0
  205. package/dist/server/routes/legal_docs_get.d.ts +3 -0
  206. package/dist/server/routes/legal_docs_get.d.ts.map +1 -0
  207. package/dist/server/routes/legal_docs_get.js +49 -0
  208. package/dist/server/routes/legal_docs_publish.d.ts +3 -0
  209. package/dist/server/routes/legal_docs_publish.d.ts.map +1 -0
  210. package/dist/server/routes/legal_docs_publish.js +35 -0
  211. package/dist/server/routes/me.d.ts.map +1 -1
  212. package/dist/server/routes/me.js +1 -43
  213. package/dist/server/routes/oauth_facebook_callback.d.ts +1 -1
  214. package/dist/server/routes/oauth_facebook_callback.d.ts.map +1 -1
  215. package/dist/server/routes/oauth_facebook_callback.js +8 -1
  216. package/dist/server/routes/oauth_google_callback.js +1 -1
  217. package/dist/server/routes/otp/verify.js +2 -2
  218. package/dist/server/routes/register.d.ts.map +1 -1
  219. package/dist/server/routes/register.js +26 -0
  220. package/dist/server/routes/strings_defaults.d.ts +4 -0
  221. package/dist/server/routes/strings_defaults.d.ts.map +1 -0
  222. package/dist/server/routes/strings_defaults.js +7 -0
  223. package/dist/server/routes/user_management_users.d.ts +11 -0
  224. package/dist/server/routes/user_management_users.d.ts.map +1 -1
  225. package/dist/server/routes/user_management_users.js +94 -0
  226. package/dist/server-lib.d.ts +0 -3
  227. package/dist/server-lib.d.ts.map +1 -1
  228. package/dist/server-lib.js +0 -2
  229. package/dist/server_pages/forgot_password.d.ts +18 -14
  230. package/dist/server_pages/forgot_password.d.ts.map +1 -1
  231. package/dist/server_pages/forgot_password.js +14 -12
  232. package/dist/server_pages/forgot_password_client_wrapper.d.ts +8 -7
  233. package/dist/server_pages/forgot_password_client_wrapper.d.ts.map +1 -1
  234. package/dist/server_pages/forgot_password_client_wrapper.js +2 -2
  235. package/dist/server_pages/index.d.ts +2 -0
  236. package/dist/server_pages/index.d.ts.map +1 -1
  237. package/dist/server_pages/index.js +1 -0
  238. package/dist/server_pages/login.d.ts +22 -23
  239. package/dist/server_pages/login.d.ts.map +1 -1
  240. package/dist/server_pages/login.js +27 -14
  241. package/dist/server_pages/login_client_wrapper.d.ts +9 -10
  242. package/dist/server_pages/login_client_wrapper.d.ts.map +1 -1
  243. package/dist/server_pages/login_client_wrapper.js +2 -2
  244. package/dist/server_pages/my_settings.d.ts +1 -3
  245. package/dist/server_pages/my_settings.d.ts.map +1 -1
  246. package/dist/server_pages/my_settings.js +2 -9
  247. package/dist/server_pages/register.d.ts +17 -20
  248. package/dist/server_pages/register.d.ts.map +1 -1
  249. package/dist/server_pages/register.js +20 -15
  250. package/dist/server_pages/register_client_wrapper.d.ts +8 -10
  251. package/dist/server_pages/register_client_wrapper.d.ts.map +1 -1
  252. package/dist/server_pages/register_client_wrapper.js +2 -2
  253. package/dist/server_pages/reset_password.d.ts +16 -11
  254. package/dist/server_pages/reset_password.d.ts.map +1 -1
  255. package/dist/server_pages/reset_password.js +14 -10
  256. package/dist/server_pages/reset_password_client_wrapper.d.ts +8 -7
  257. package/dist/server_pages/reset_password_client_wrapper.d.ts.map +1 -1
  258. package/dist/server_pages/reset_password_client_wrapper.js +2 -2
  259. package/dist/server_pages/verify_email.d.ts +18 -12
  260. package/dist/server_pages/verify_email.d.ts.map +1 -1
  261. package/dist/server_pages/verify_email.js +13 -11
  262. package/dist/server_pages/verify_email_client_wrapper.d.ts +8 -7
  263. package/dist/server_pages/verify_email_client_wrapper.d.ts.map +1 -1
  264. package/dist/server_pages/verify_email_client_wrapper.js +2 -2
  265. package/dist/strings.d.ts +2 -0
  266. package/dist/strings.d.ts.map +1 -0
  267. package/dist/strings.js +3 -0
  268. package/dist/themes/index.d.ts +0 -1
  269. package/dist/themes/index.d.ts.map +1 -1
  270. package/dist/themes/index.js +1 -1
  271. package/package.json +30 -61
  272. package/dist/themes/preset_indigo_sunset.d.ts +0 -3
  273. package/dist/themes/preset_indigo_sunset.d.ts.map +0 -1
  274. package/dist/themes/preset_indigo_sunset.js +0 -20
@@ -1,13 +1,3 @@
1
- // file_description: Type definitions and error classes for hazo_get_auth utility
2
- //
3
- // Naming note (v6.0.0): the field previously called `organization` (and
4
- // `organization_id`) on `TenantAuthResult` was renamed to `selected_scope`
5
- // (and `selected_scope_id`), and the type `TenantOrganization` was renamed
6
- // to `SelectedScope`. The multi-tenancy model is scopes throughout; the
7
- // old name was a legacy synonym for "the currently selected scope" derived
8
- // from the scope-selection cookie/header. No deprecation shim is provided.
9
- //
10
- // section: types
11
1
  /**
12
2
  * Custom error class for permission denials
13
3
  * Includes technical and user-friendly error messages
@@ -1 +1 @@
1
- {"version":3,"file":"hazo_get_auth.server.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/hazo_get_auth.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,OAAO,KAAK,EACV,cAAc,EAEd,eAAe,EAGhB,MAAM,cAAc,CAAC;AA6CtB;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAU1D;AA4SD;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,cAAc,CAAC,CAmNzB"}
1
+ {"version":3,"file":"hazo_get_auth.server.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/hazo_get_auth.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,OAAO,KAAK,EACV,cAAc,EAEd,eAAe,EAGhB,MAAM,cAAc,CAAC;AA+DtB;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAU1D;AA6SD;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,cAAc,CAAC,CAmNzB"}
@@ -39,6 +39,24 @@ function parse_app_user_data(json_string) {
39
39
  return null;
40
40
  }
41
41
  }
42
+ /**
43
+ * Parse raw legal_acceptance field from DB to LegalAcceptanceMap
44
+ * @param raw - Raw value from database (string or object)
45
+ * @returns Parsed LegalAcceptanceMap or null
46
+ */
47
+ function parse_legal_acceptance(raw) {
48
+ if (!raw)
49
+ return null;
50
+ try {
51
+ const parsed = typeof raw === 'string' ? JSON.parse(raw) : raw;
52
+ if (typeof parsed !== 'object' || Array.isArray(parsed))
53
+ return null;
54
+ return parsed;
55
+ }
56
+ catch (_a) {
57
+ return null;
58
+ }
59
+ }
42
60
  /**
43
61
  * Gets client IP address from request
44
62
  * @param request - NextRequest object
@@ -132,6 +150,7 @@ async function fetch_user_data_from_db(user_id) {
132
150
  profile_picture_url: user_db.profile_picture_url || null,
133
151
  managed_by_user_id: user_db.managed_by_user_id || null,
134
152
  app_user_data: parse_app_user_data(user_db.app_user_data),
153
+ legal_acceptance: parse_legal_acceptance(user_db.legal_acceptance),
135
154
  };
136
155
  // v5.x: Fetch user's roles from hazo_user_scopes (scope-based role assignments)
137
156
  // Each scope assignment has a role_id (string UUID)
@@ -13,21 +13,20 @@ export declare function extract_scope_id_from_request(request: NextRequest, opti
13
13
  * Tenant-aware authentication function
14
14
  *
15
15
  * Extracts tenant/scope context from request headers or cookies,
16
- * validates access, and returns enriched result including the currently
17
- * selected scope.
16
+ * validates access, and returns enriched result with organization info.
18
17
  *
19
18
  * Header priority: X-Hazo-Scope-Id > Cookie
20
19
  *
21
20
  * @param request - NextRequest object
22
21
  * @param options - TenantAuthOptions for customization
23
- * @returns TenantAuthResult with user, permissions, selected_scope, and user_scopes
22
+ * @returns TenantAuthResult with user, permissions, organization, and user_scopes
24
23
  *
25
24
  * @example
26
25
  * ```typescript
27
26
  * const auth = await hazo_get_tenant_auth(request);
28
- * if (auth.authenticated && auth.selected_scope) {
27
+ * if (auth.authenticated && auth.organization) {
29
28
  * // Access tenant-specific data
30
- * const data = await getData(auth.selected_scope.id);
29
+ * const data = await getData(auth.organization.id);
31
30
  * }
32
31
  * ```
33
32
  */
@@ -42,15 +41,15 @@ export declare function hazo_get_tenant_auth(request: NextRequest, options?: Ten
42
41
  *
43
42
  * @param request - NextRequest object
44
43
  * @param options - TenantAuthOptions for customization
45
- * @returns RequiredTenantAuthResult with guaranteed non-null selected_scope
44
+ * @returns RequiredTenantAuthResult with guaranteed non-null organization
46
45
  * @throws AuthenticationRequiredError, TenantRequiredError, TenantAccessDeniedError
47
46
  *
48
47
  * @example
49
48
  * ```typescript
50
49
  * try {
51
50
  * const auth = await require_tenant_auth(request);
52
- * // auth.selected_scope is guaranteed non-null here
53
- * const data = await getData(auth.selected_scope.id);
51
+ * // auth.organization is guaranteed non-null here
52
+ * const data = await getData(auth.organization.id);
54
53
  * } catch (error) {
55
54
  * if (error instanceof HazoAuthError) {
56
55
  * return NextResponse.json(
@@ -1 +1 @@
1
- {"version":3,"file":"hazo_get_tenant_auth.server.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/hazo_get_tenant_auth.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO1C,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EAGzB,MAAM,cAAc,CAAC;AAqBtB;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,iBAAiB,GACzB,MAAM,GAAG,SAAS,CAYpB;AAiCD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,WAAW,EACpB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,gBAAgB,CAAC,CA0F3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,WAAW,EACpB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,wBAAwB,CAAC,CA0BnC"}
1
+ {"version":3,"file":"hazo_get_tenant_auth.server.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/hazo_get_tenant_auth.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO1C,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EAGzB,MAAM,cAAc,CAAC;AAqBtB;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,iBAAiB,GACzB,MAAM,GAAG,SAAS,CAYpB;AAiCD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,WAAW,EACpB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,gBAAgB,CAAC,CA0F3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,WAAW,EACpB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,wBAAwB,CAAC,CA0BnC"}
@@ -39,12 +39,12 @@ export function extract_scope_id_from_request(request, options) {
39
39
  return cookie_value;
40
40
  }
41
41
  /**
42
- * Builds SelectedScope from scope details and access info.
42
+ * Builds TenantOrganization from scope details and access info
43
43
  * @param scope_details - Full scope details from cache
44
44
  * @param is_super_admin - Whether user is accessing as super admin
45
- * @returns SelectedScope object
45
+ * @returns TenantOrganization object
46
46
  */
47
- function build_selected_scope(scope_details, is_super_admin) {
47
+ function build_tenant_organization(scope_details, is_super_admin) {
48
48
  return {
49
49
  id: scope_details.id,
50
50
  name: scope_details.name,
@@ -67,21 +67,20 @@ function build_selected_scope(scope_details, is_super_admin) {
67
67
  * Tenant-aware authentication function
68
68
  *
69
69
  * Extracts tenant/scope context from request headers or cookies,
70
- * validates access, and returns enriched result including the currently
71
- * selected scope.
70
+ * validates access, and returns enriched result with organization info.
72
71
  *
73
72
  * Header priority: X-Hazo-Scope-Id > Cookie
74
73
  *
75
74
  * @param request - NextRequest object
76
75
  * @param options - TenantAuthOptions for customization
77
- * @returns TenantAuthResult with user, permissions, selected_scope, and user_scopes
76
+ * @returns TenantAuthResult with user, permissions, organization, and user_scopes
78
77
  *
79
78
  * @example
80
79
  * ```typescript
81
80
  * const auth = await hazo_get_tenant_auth(request);
82
- * if (auth.authenticated && auth.selected_scope) {
81
+ * if (auth.authenticated && auth.organization) {
83
82
  * // Access tenant-specific data
84
- * const data = await getData(auth.selected_scope.id);
83
+ * const data = await getData(auth.organization.id);
85
84
  * }
86
85
  * ```
87
86
  */
@@ -99,8 +98,8 @@ export async function hazo_get_tenant_auth(request, options = {}) {
99
98
  user: null,
100
99
  permissions: [],
101
100
  permission_ok: false,
102
- selected_scope: null,
103
- selected_scope_id: null,
101
+ organization: null,
102
+ organization_id: null,
104
103
  user_scopes: [],
105
104
  scope_ok: false,
106
105
  };
@@ -111,20 +110,20 @@ export async function hazo_get_tenant_auth(request, options = {}) {
111
110
  const cached = cache.get(auth_result.user.id);
112
111
  // User scopes from cache or empty array
113
112
  const user_scopes = (cached === null || cached === void 0 ? void 0 : cached.scopes) || [];
114
- // Build selected_scope info if scope access was successful
115
- let selected_scope = null;
113
+ // Build organization info if scope access was successful
114
+ let organization = null;
116
115
  if (scope_id && auth_result.scope_ok && auth_result.scope_access_via) {
117
116
  // Find the scope in user's scopes that matches the access_via scope
118
117
  const access_scope = user_scopes.find((s) => { var _a; return s.id === ((_a = auth_result.scope_access_via) === null || _a === void 0 ? void 0 : _a.scope_id); });
119
118
  if (access_scope) {
120
- selected_scope = build_selected_scope(access_scope, auth_result.scope_access_via.is_super_admin || false);
119
+ organization = build_tenant_organization(access_scope, auth_result.scope_access_via.is_super_admin || false);
121
120
  }
122
121
  else if (auth_result.scope_access_via.is_super_admin) {
123
122
  // Super admin accessing scope they're not assigned to - fetch scope details
124
123
  const hazoConnect = get_hazo_connect_instance();
125
124
  const scope_result = await get_scope_by_id(hazoConnect, scope_id);
126
125
  if (scope_result.success && scope_result.scope) {
127
- selected_scope = {
126
+ organization = {
128
127
  id: scope_result.scope.id,
129
128
  name: scope_result.scope.name,
130
129
  slug: null, // Could fetch from scope if slug column exists
@@ -149,8 +148,8 @@ export async function hazo_get_tenant_auth(request, options = {}) {
149
148
  permissions: auth_result.permissions,
150
149
  permission_ok: auth_result.permission_ok,
151
150
  missing_permissions: auth_result.missing_permissions,
152
- selected_scope,
153
- selected_scope_id: (selected_scope === null || selected_scope === void 0 ? void 0 : selected_scope.id) || null,
151
+ organization,
152
+ organization_id: (organization === null || organization === void 0 ? void 0 : organization.id) || null,
154
153
  user_scopes,
155
154
  scope_ok: auth_result.scope_ok,
156
155
  scope_access_via: auth_result.scope_access_via,
@@ -166,15 +165,15 @@ export async function hazo_get_tenant_auth(request, options = {}) {
166
165
  *
167
166
  * @param request - NextRequest object
168
167
  * @param options - TenantAuthOptions for customization
169
- * @returns RequiredTenantAuthResult with guaranteed non-null selected_scope
168
+ * @returns RequiredTenantAuthResult with guaranteed non-null organization
170
169
  * @throws AuthenticationRequiredError, TenantRequiredError, TenantAccessDeniedError
171
170
  *
172
171
  * @example
173
172
  * ```typescript
174
173
  * try {
175
174
  * const auth = await require_tenant_auth(request);
176
- * // auth.selected_scope is guaranteed non-null here
177
- * const data = await getData(auth.selected_scope.id);
175
+ * // auth.organization is guaranteed non-null here
176
+ * const data = await getData(auth.organization.id);
178
177
  * } catch (error) {
179
178
  * if (error instanceof HazoAuthError) {
180
179
  * return NextResponse.json(
@@ -198,10 +197,10 @@ export async function require_tenant_auth(request, options = {}) {
198
197
  if (scope_id && !result.scope_ok) {
199
198
  throw new TenantAccessDeniedError(scope_id, result.user_scopes);
200
199
  }
201
- // Check if scope context is required but missing
202
- if (!result.selected_scope) {
203
- throw new TenantRequiredError("No tenant scope context provided. Include X-Hazo-Scope-Id header or scope cookie.", result.user_scopes);
200
+ // Check if organization context is required but missing
201
+ if (!result.organization) {
202
+ throw new TenantRequiredError("No organization context provided. Include X-Hazo-Scope-Id header or scope cookie.", result.user_scopes);
204
203
  }
205
- // Type assertion: at this point we know selected_scope is non-null
204
+ // Type assertion: at this point we know organization is non-null
206
205
  return result;
207
206
  }
@@ -4,12 +4,12 @@ export { get_authenticated_user, require_auth, is_authenticated, } from "./auth_
4
4
  export type { AuthResult, AuthUser } from "./auth_utils.server";
5
5
  export { ensure_anon_id } from "./ensure_anon_id.server.js";
6
6
  export { hazo_get_tenant_auth, require_tenant_auth, extract_scope_id_from_request, } from "./hazo_get_tenant_auth.server.js";
7
- export type { ScopeDetails, SelectedScope, TenantAuthOptions, TenantAuthResult, RequiredTenantAuthResult, } from "./auth_types";
7
+ export type { ScopeDetails, TenantOrganization, TenantAuthOptions, TenantAuthResult, RequiredTenantAuthResult, } from "./auth_types";
8
8
  export { HazoAuthError, AuthenticationRequiredError, TenantRequiredError, TenantAccessDeniedError, } from "./auth_types.js";
9
9
  export { get_server_auth_user } from "./server_auth.js";
10
10
  export type { ServerAuthResult } from "./server_auth";
11
11
  export { withAuth, withOptionalAuth, hasPermission, hasAllPermissions, hasAnyPermission, requirePermission, requireAllPermissions, } from "./with_auth.server.js";
12
- export type { AuthenticatedTenantAuth, AuthenticatedTenantAuthWithSelectedScope, WithAuthOptions, } from "./with_auth.server";
12
+ export type { AuthenticatedTenantAuth, AuthenticatedTenantAuthWithOrg, WithAuthOptions, } from "./with_auth.server";
13
13
  export { get_auth_cache, reset_auth_cache } from "./auth_cache.js";
14
14
  export { get_rate_limiter, reset_rate_limiter } from "./auth_rate_limiter.js";
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/index.ts"],"names":[],"mappings":"AAEA,cAAc,cAAc,CAAC;AAG7B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EACL,s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EAAE,MAAM,yBAAyB,CAAC;AAGzD,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,6BAA6B,GAC9B,MAAM,+BAA+B,CAAC;AACvC,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,aAAa,EACb,2BAA2B,EAC3B,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtD,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,uBAAuB,EACvB,8BAA8B,EAC9B,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -20,16 +20,6 @@ export type NextAuthCallbackProfile = {
20
20
  picture?: string;
21
21
  email_verified?: boolean;
22
22
  };
23
- export type FacebookCallbackProfile = {
24
- id?: string;
25
- name?: string;
26
- email?: string;
27
- picture?: {
28
- data?: {
29
- url: string;
30
- };
31
- } | string;
32
- };
33
23
  /**
34
24
  * Gets NextAuth.js configuration with enabled OAuth providers
35
25
  * Providers are dynamically configured based on hazo_auth_config.ini settings
@@ -1 +1 @@
1
- {"version":3,"file":"nextauth_config.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/nextauth_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAW,MAAM,WAAW,CAAC;AAatD,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,CAAC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AC;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,WAAW,CAkOjD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAW7C"}
@@ -4,7 +4,7 @@ const GoogleProvider = GoogleProviderImport.default || GoogleProviderImport;
4
4
  import FacebookProviderImport from "next-auth/providers/facebook";
5
5
  const FacebookProvider = FacebookProviderImport.default || FacebookProviderImport;
6
6
  import { get_oauth_config } from "../oauth_config.server.js";
7
- import { handle_google_oauth_login, handle_facebook_oauth_login } from "../services/oauth_service.js";
7
+ import { handle_google_oauth_login } from "../services/oauth_service.js";
8
8
  import { get_hazo_connect_instance } from "../hazo_connect_instance.server.js";
9
9
  import { create_app_logger } from "../app_logger.js";
10
10
  // section: config
@@ -34,16 +34,11 @@ export function get_nextauth_config() {
34
34
  }));
35
35
  }
36
36
  }
37
- // Add Facebook provider if enabled and credentials are present
38
- if (oauth_config.enable_facebook && oauth_config.facebook_client_id && oauth_config.facebook_client_secret) {
37
+ // Add Facebook provider if enabled
38
+ if (oauth_config.enable_facebook_oauth && oauth_config.facebook_app_id) {
39
39
  providers.push(FacebookProvider({
40
- clientId: oauth_config.facebook_client_id,
41
- clientSecret: oauth_config.facebook_client_secret,
42
- authorization: {
43
- params: {
44
- scope: "email,public_profile",
45
- },
46
- },
40
+ clientId: oauth_config.facebook_app_id,
41
+ clientSecret: oauth_config.facebook_app_secret,
47
42
  }));
48
43
  }
49
44
  return {
@@ -63,10 +58,8 @@ export function get_nextauth_config() {
63
58
  console.log("[NextAuth redirect callback]", { url, baseUrl });
64
59
  // Always redirect to our custom callback after sign-in to set hazo_auth cookies
65
60
  // The callbackUrl from signIn() comes through as `url`
66
- if (url.includes("/api/hazo_auth/oauth/google/callback")) {
67
- return url;
68
- }
69
- if (url.includes("/api/hazo_auth/oauth/facebook/callback")) {
61
+ if (url.includes("/api/hazo_auth/oauth/google/callback") ||
62
+ url.includes("/api/hazo_auth/oauth/facebook/callback")) {
70
63
  return url;
71
64
  }
72
65
  // If URL is relative or same origin, allow it
@@ -77,13 +70,16 @@ export function get_nextauth_config() {
77
70
  return url;
78
71
  }
79
72
  // Default: redirect to our custom OAuth callback to set cookies
73
+ if (url.includes("facebook")) {
74
+ return `${baseUrl}/api/hazo_auth/oauth/facebook/callback`;
75
+ }
80
76
  return `${baseUrl}/api/hazo_auth/oauth/google/callback`;
81
77
  },
82
78
  /**
83
79
  * Sign-in callback - handle user creation/linking for Google OAuth
84
80
  */
85
81
  async signIn({ account, profile, user, }) {
86
- var _a, _b, _c, _d, _e, _f;
82
+ var _a;
87
83
  const logger = create_app_logger();
88
84
  if ((account === null || account === void 0 ? void 0 : account.provider) === "google" && profile) {
89
85
  try {
@@ -132,39 +128,22 @@ export function get_nextauth_config() {
132
128
  try {
133
129
  const fbProfile = profile;
134
130
  const hazoConnect = get_hazo_connect_instance();
135
- const current_oauth_config = get_oauth_config();
136
- // Resolve profile picture URL from Facebook's nested structure
137
- let fb_picture_url;
138
- if (fbProfile.picture) {
139
- if (typeof fbProfile.picture === "string") {
140
- fb_picture_url = fbProfile.picture;
141
- }
142
- else if ((_c = (_b = fbProfile.picture) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.url) {
143
- fb_picture_url = fbProfile.picture.data.url;
144
- }
145
- }
146
- if (!fb_picture_url && user.image) {
147
- fb_picture_url = (_d = user.image) !== null && _d !== void 0 ? _d : undefined;
148
- }
131
+ const { handle_facebook_oauth_login } = await import("../services/oauth_service");
149
132
  logger.info("nextauth_facebook_signin_attempt", {
150
133
  email: user.email,
151
- facebook_id: fbProfile.id,
152
- name: user.name,
134
+ facebook_id: account.providerAccountId,
153
135
  });
154
136
  const result = await handle_facebook_oauth_login(hazoConnect, {
155
- facebook_id: fbProfile.id || account.providerAccountId,
156
- email: (_f = (_e = user.email) !== null && _e !== void 0 ? _e : fbProfile.email) !== null && _f !== void 0 ? _f : null,
137
+ facebook_id: account.providerAccountId,
138
+ email: user.email || fbProfile.email || "",
157
139
  name: user.name || fbProfile.name || undefined,
158
- profile_picture_url: fb_picture_url,
159
- }, { auto_link_unverified: current_oauth_config.auto_link_unverified_accounts_facebook });
140
+ profile_picture_url: user.image || undefined,
141
+ // Facebook's email_verified is not exposed in the profile; default to false
142
+ // for safety — the user will be auto-verified if email matches a verified hazo user.
143
+ email_verified: false,
144
+ });
160
145
  if (!result.success) {
161
- logger.error("nextauth_facebook_signin_failed", {
162
- email: user.email,
163
- error: result.error,
164
- });
165
- if (result.error === "link_blocked_unverified") {
166
- return `/hazo_auth/login?error=link_blocked_unverified`;
167
- }
146
+ logger.error("nextauth_facebook_signin_failed", { email: user.email, error: result.error });
168
147
  return false;
169
148
  }
170
149
  logger.info("nextauth_facebook_signin_success", {
@@ -173,16 +152,11 @@ export function get_nextauth_config() {
173
152
  is_new_user: result.is_new_user,
174
153
  was_linked: result.was_linked,
175
154
  });
176
- // Store user_id in account for the JWT callback to pick up
177
155
  account.hazo_user_id = result.user_id;
178
156
  return true;
179
157
  }
180
- catch (error) {
181
- const errorMessage = error instanceof Error ? error.message : "Unknown error";
182
- logger.error("nextauth_facebook_signin_exception", {
183
- email: user.email,
184
- error: errorMessage,
185
- });
158
+ catch (err) {
159
+ logger.error("nextauth_facebook_signin_exception", { error: String(err) });
186
160
  return false;
187
161
  }
188
162
  }
@@ -244,8 +218,5 @@ export function has_oauth_providers() {
244
218
  if (has_google_credentials)
245
219
  return true;
246
220
  }
247
- if (oauth_config.enable_facebook && oauth_config.facebook_client_id && oauth_config.facebook_client_secret) {
248
- return true;
249
- }
250
221
  return false;
251
222
  }
@@ -1,6 +1,6 @@
1
1
  import "server-only";
2
2
  import { NextRequest, NextResponse } from "next/server";
3
- import { type TenantAuthOptions, type TenantAuthResult, type SelectedScope, type HazoAuthUser, type ScopeDetails, type ScopeAccessInfo } from "./auth_types.js";
3
+ import { type TenantAuthOptions, type TenantAuthResult, type TenantOrganization, type HazoAuthUser, type ScopeDetails, type ScopeAccessInfo } from "./auth_types.js";
4
4
  /**
5
5
  * Authenticated branch of TenantAuthResult - guaranteed authenticated: true
6
6
  */
@@ -10,18 +10,18 @@ export type AuthenticatedTenantAuth = {
10
10
  permissions: string[];
11
11
  permission_ok: boolean;
12
12
  missing_permissions?: string[];
13
- selected_scope: SelectedScope | null;
14
- selected_scope_id: string | null;
13
+ organization: TenantOrganization | null;
14
+ organization_id: string | null;
15
15
  user_scopes: ScopeDetails[];
16
16
  scope_ok?: boolean;
17
17
  scope_access_via?: ScopeAccessInfo;
18
18
  };
19
19
  /**
20
- * Authenticated branch with guaranteed non-null selected_scope
20
+ * Authenticated branch with guaranteed non-null organization
21
21
  */
22
- export type AuthenticatedTenantAuthWithSelectedScope = AuthenticatedTenantAuth & {
23
- selected_scope: SelectedScope;
24
- selected_scope_id: string;
22
+ export type AuthenticatedTenantAuthWithOrg = AuthenticatedTenantAuth & {
23
+ organization: TenantOrganization;
24
+ organization_id: string;
25
25
  };
26
26
  /**
27
27
  * Options for withAuth/withOptionalAuth wrappers
@@ -29,8 +29,8 @@ export type AuthenticatedTenantAuthWithSelectedScope = AuthenticatedTenantAuth &
29
29
  */
30
30
  export type WithAuthOptions = TenantAuthOptions & {
31
31
  /**
32
- * If true, requires tenant/scope context (403 if missing)
33
- * Narrows auth type to AuthenticatedTenantAuthWithSelectedScope
32
+ * If true, requires organization context (403 if missing)
33
+ * Narrows auth type to AuthenticatedTenantAuthWithOrg
34
34
  */
35
35
  require_tenant?: boolean;
36
36
  };
@@ -47,7 +47,7 @@ type AuthenticatedHandler<TParams> = (request: NextRequest, auth: AuthenticatedT
47
47
  /**
48
48
  * Handler function signature for withAuth with require_tenant
49
49
  */
50
- type AuthenticatedTenantHandler<TParams> = (request: NextRequest, auth: AuthenticatedTenantAuthWithSelectedScope, params: TParams) => Promise<NextResponse> | NextResponse;
50
+ type AuthenticatedTenantHandler<TParams> = (request: NextRequest, auth: AuthenticatedTenantAuthWithOrg, params: TParams) => Promise<NextResponse> | NextResponse;
51
51
  /**
52
52
  * Handler function signature for withOptionalAuth
53
53
  */
@@ -57,7 +57,7 @@ type OptionalAuthHandler<TParams> = (request: NextRequest, auth: TenantAuthResul
57
57
  *
58
58
  * - Calls `hazo_get_tenant_auth` and returns 401 if not authenticated
59
59
  * - Returns 403 if `required_permissions` are specified and not satisfied
60
- * - Returns 403 if `require_tenant: true` and no tenant/scope context
60
+ * - Returns 403 if `require_tenant: true` and no organization context
61
61
  * - Resolves `await context.params` (Next.js 15 pattern)
62
62
  * - Catches HazoAuthError, PermissionError, and unexpected errors
63
63
  *
@@ -80,8 +80,8 @@ type OptionalAuthHandler<TParams> = (request: NextRequest, auth: TenantAuthResul
80
80
  * // With tenant requirement
81
81
  * export const GET = withAuth<{ id: string }>(
82
82
  * async (request, auth, { id }) => {
83
- * // auth.selected_scope is guaranteed non-null
84
- * const data = await getData(auth.selected_scope.id, id);
83
+ * // auth.organization is guaranteed non-null
84
+ * const data = await getData(auth.organization.id, id);
85
85
  * return NextResponse.json(data);
86
86
  * },
87
87
  * { require_tenant: true }
@@ -1 +1 @@
1
- {"version":3,"file":"with_auth.server.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/with_auth.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,EACrB,MAAM,cAAc,CAAC;AAItB;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,aAAa,EAAE,IAAI,CAAC;IACpB,IAAI,EAAE,YAAY,CAAC;IACnB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,cAAc,EAAE,aAAa,GAAG,IAAI,CAAC;IACrC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,WAAW,EAAE,YAAY,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,eAAe,CAAC;CACpC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,wCAAwC,GAAG,uBAAuB,GAAG;IAC/E,cAAc,EAAE,aAAa,CAAC;IAC9B,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG;IAChD;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,KAAK,YAAY,CAAC,OAAO,IAAI;IAC3B,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,KAAK,oBAAoB,CAAC,OAAO,IAAI,CACnC,OAAO,EAAE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,EACrC,OAAO,GAAE,iBAAsB,GAC9B,CACD,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,KAC5B,OAAO,CAAC,YAAY,CAAC,CAazB;AAID;;GAEG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,uBAAuB,EAC7B,UAAU,EAAE,MAAM,GACjB,OAAO,CAET;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,uBAAuB,EAC7B,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CAET;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,uBAAuB,EAC7B,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CAET;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,uBAAuB,EAC7B,UAAU,EAAE,MAAM,GACjB,IAAI,CAQN;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,uBAAuB,EAC7B,WAAW,EAAE,MAAM,EAAE,GACpB,IAAI,CASN"}
1
+ {"version":3,"file":"with_auth.server.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/with_auth.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,EACrB,MAAM,cAAc,CAAC;AAItB;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,aAAa,EAAE,IAAI,CAAC;IACpB,IAAI,EAAE,YAAY,CAAC;IACnB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,YAAY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AqB,CACnC,IAAI,EAAE,uBAAuB,EAC7B,WAAW,EAAE,MAAM,EAAE,GACpB,IAAI,CASN"}
@@ -50,9 +50,9 @@ export function withAuth(handler, options = {}) {
50
50
  })), { status: 403 });
51
51
  }
52
52
  // Check tenant requirement
53
- if (options.require_tenant && !auth.selected_scope) {
53
+ if (options.require_tenant && !auth.organization) {
54
54
  return NextResponse.json({
55
- error: "Tenant scope context required",
55
+ error: "Organization context required",
56
56
  code: "TENANT_REQUIRED",
57
57
  }, { status: 403 });
58
58
  }
@@ -136,6 +136,14 @@ export declare const DEFAULT_OAUTH: {
136
136
  readonly skip_invitation_check: false;
137
137
  /** Redirect when skip_invitation_check=true and user has no scope */
138
138
  readonly no_scope_redirect: "/";
139
+ /** Enable Facebook OAuth login (requires HAZO_AUTH_FACEBOOK_APP_ID and HAZO_AUTH_FACEBOOK_APP_SECRET env vars) */
140
+ readonly enable_facebook_oauth: false;
141
+ /** Facebook App ID — set via env var HAZO_AUTH_FACEBOOK_APP_ID or config */
142
+ readonly facebook_app_id: "";
143
+ /** Facebook App Secret — set via env var HAZO_AUTH_FACEBOOK_APP_SECRET or config */
144
+ readonly facebook_app_secret: "";
145
+ /** Text displayed on the Facebook sign-in button */
146
+ readonly facebook_button_text: "Continue with Facebook";
139
147
  };
140
148
  export declare const DEFAULT_NAVBAR: {
141
149
  /** Enable navbar on auth pages */
@@ -362,6 +370,14 @@ export declare const HAZO_AUTH_DEFAULTS: {
362
370
  readonly skip_invitation_check: false;
363
371
  /** Redirect when skip_invitation_check=true and user has no scope */
364
372
  readonly no_scope_redirect: "/";
373
+ /** Enable Facebook OAuth login (requires HAZO_AUTH_FACEBOOK_APP_ID and HAZO_AUTH_FACEBOOK_APP_SECRET env vars) */
374
+ readonly enable_facebook_oauth: false;
375
+ /** Facebook App ID — set via env var HAZO_AUTH_FACEBOOK_APP_ID or config */
376
+ readonly facebook_app_id: "";
377
+ /** Facebook App Secret — set via env var HAZO_AUTH_FACEBOOK_APP_SECRET or config */
378
+ readonly facebook_app_secret: "";
379
+ /** Text displayed on the Facebook sign-in button */
380
+ readonly facebook_button_text: "Continue with Facebook";
365
381
  };
366
382
  readonly devLock: {
367
383
  /** Enable the development lock screen (also requires HAZO_AUTH_DEV_LOCK_ENABLED env var) */
@@ -1 +1 @@
1
- {"version":3,"file":"default_config.d.ts","sourceRoot":"","sources":["../../../src/lib/config/default_config.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,6BAA6B;;;;;;CAMhC,CAAC;AAGX,eAAO,MAAM,mBAAmB;;;;CAItB,CAAC;AAGX,eAAO,MAAM,uBAAuB;;;;;;;CAO1B,CAAC;AAGX,eAAO,MAAM,gBAAgB;;;;;;;;;CASnB,CAAC;AAGX,eAAO,MAAM,kBAAkB;;;CAGrB,CAAC;AAGX,eAAO,MAAM,gBAAgB;;;;;CAKnB,CAAC;AAGX,eAAO,MAAM,yBAAyB;;;;;;CAM5B,CAAC;AAGX,eAAO,MAAM,aAAa;4BACI,MAAM,GAAG,SAAS;;;;;;CAMtC,CAAC;AAGX,eAAO,MAAM,gBAAgB;4BACC,MAAM,GAAG,SAAS;;;;;CAKtC,CAAC;AAGX,eAAO,MAAM,uBAAuB;;;;CAI1B,CAAC;AAGX,eAAO,MAAM,sBAAsB;;;;CAIzB,CAAC;AAGX,eAAO,MAAM,0BAA0B;;;;;CAK7B,CAAC;AAGX,eAAO,MAAM,mBAAmB;;;;;CAKtB,CAAC;AAGX,eAAO,MAAM,uBAAuB;;;;CAI1B,CAAC;AAGX,eAAO,MAAM,oBAAoB;;;;CAIvB,CAAC;AAGX,eAAO,MAAM,gBAAgB;0BACE,YAAY,GAAG,cAAc;;;;;IAK1D,2DAA2D;;CAEnD,CAAC;AAGX,eAAO,MAAM,wBAAwB;;;;;;;;CAQ3B,CAAC;AAGX,eAAO,MAAM,iBAAiB;;CAEpB,CAAC;AAGX,eAAO,MAAM,aAAa;IACxB,kHAAkH;;IAElH,8CAA8C;;IAE9C,iGAAiG;;IAEjG,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QAE5B,sDAAsD;;QAEtD,qBAAqB;;QAErB,sBAAsB;;QAEtB,qBAAqB;;QAErB,4DAA4D;;QAE5D,0CAA0C;;QAE1C,kEAAkE;;;;QAMlE,iDAAiD;;QAEjD,2DAA2D;;;;QAM3D,wDAAwD;;QAExD,yDAAyD;;QAEzD,mDAAmD;;QAEnD,0DAA0D;;;;QAM1D,qFAAqF;;QAErF,mEAAmE;;QAEnE,qEAAqE;;QAErE,gEAAgE;;QAEhE,+DAA+D;;QAE/D,+DAA+D;;;CAgEvD,CAAC;AAGX;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,kBAAkB,CAAC"}
@@ -158,6 +158,14 @@ export const DEFAULT_OAUTH = {
158
158
  skip_invitation_check: false,
159
159
  /** Redirect when skip_invitation_check=true and user has no scope */
160
160
  no_scope_redirect: "/",
161
+ /** Enable Facebook OAuth login (requires HAZO_AUTH_FACEBOOK_APP_ID and HAZO_AUTH_FACEBOOK_APP_SECRET env vars) */
162
+ enable_facebook_oauth: false,
163
+ /** Facebook App ID — set via env var HAZO_AUTH_FACEBOOK_APP_ID or config */
164
+ facebook_app_id: "",
165
+ /** Facebook App Secret — set via env var HAZO_AUTH_FACEBOOK_APP_SECRET or config */
166
+ facebook_app_secret: "",
167
+ /** Text displayed on the Facebook sign-in button */
168
+ facebook_button_text: "Continue with Facebook",
161
169
  };
162
170
  // section: navbar
163
171
  export const DEFAULT_NAVBAR = {
@@ -9,10 +9,10 @@ export declare const BASE_COOKIE_NAMES: {
9
9
  readonly USER_ID: "hazo_auth_user_id";
10
10
  readonly USER_EMAIL: "hazo_auth_user_email";
11
11
  readonly SESSION: "hazo_auth_session";
12
- readonly SESSION_KIND: "hazo_auth_session_kind";
13
12
  readonly DEV_LOCK: "hazo_auth_dev_lock";
14
13
  readonly SCOPE_ID: "hazo_auth_scope_id";
15
14
  readonly ANON_ID: "hazo_auth_anon_id";
15
+ readonly SESSION_KIND: "hazo_auth_session_kind";
16
16
  };
17
17
  /**
18
18
  * Reads cookie configuration from hazo_auth_config.ini file
@@ -14,10 +14,10 @@ export const BASE_COOKIE_NAMES = {
14
14
  USER_ID: "hazo_auth_user_id",
15
15
  USER_EMAIL: "hazo_auth_user_email",
16
16
  SESSION: "hazo_auth_session",
17
- SESSION_KIND: "hazo_auth_session_kind", // v6.1: marks OTP-issued sessions so /me can apply sliding expiry
18
17
  DEV_LOCK: "hazo_auth_dev_lock",
19
18
  SCOPE_ID: "hazo_auth_scope_id", // v5.2: Tenant context cookie for multi-tenancy
20
19
  ANON_ID: "hazo_auth_anon_id", // v5.2: Stable opaque per-visitor ID for anonymous flows (e.g. hazo_feedback)
20
+ SESSION_KIND: "hazo_auth_session_kind", // v5.4: Sign-in method identifier (e.g. "otp", "google", "password")
21
21
  };
22
22
  // section: main_function
23
23
  /**
@@ -5,6 +5,9 @@ export type EmailVerificationConfig = {
5
5
  showReturnHomeButton: boolean;
6
6
  returnHomeButtonLabel: string;
7
7
  returnHomePath: string;
8
+ imageSrc: string;
9
+ imageAlt: string;
10
+ imageBackgroundColor: string;
8
11
  };
9
12
  /**
10
13
  * Reads email verification layout configuration from hazo_auth_config.ini file
@@ -1 +1 @@
1
- {"version":3,"file":"email_verification_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/email_verification_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAMrB,MAAM,MAAM,uBAAuB,GAAG;IACpC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,6BAA6B,IAAI,uBAAuB,CAWvE"}
1
+ {"version":3,"file":"email_verification_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/email_verification_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAYrB,MAAM,MAAM,uBAAuB,GAAG;IACpC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,6BAA6B,IAAI,uBAAuB,CAoCvE"}