ldap-rest 1.2.0 → 1.3.0

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 (342) hide show
  1. package/bin/sync-james.mjs +13 -2
  2. package/dist/abstract/ldapFlat.js +1 -1
  3. package/dist/abstract/plugin.js +1 -1
  4. package/dist/abstract/twakePlugin.js +1 -1
  5. package/dist/bin/index.js +1 -1
  6. package/dist/config/args.js +1 -1
  7. package/dist/config/options.js +1 -0
  8. package/dist/config/schema.js +1 -1
  9. package/dist/lib/auth/base.js +1 -1
  10. package/dist/lib/authz/base.js +1 -1
  11. package/dist/lib/entitySchema/validator.js +1 -1
  12. package/dist/lib/errors.js +1 -1
  13. package/dist/lib/expressFormatedResponses.js +1 -1
  14. package/dist/lib/health.js +1 -1
  15. package/dist/lib/hookBus.js +1 -0
  16. package/dist/lib/instanceProviders.js +1 -1
  17. package/dist/lib/ldapActions.js +1 -1
  18. package/dist/lib/ldapSchema.js +1 -1
  19. package/dist/lib/parseConfig.js +1 -1
  20. package/dist/lib/route.js +1 -0
  21. package/dist/lib/schemaFile.js +1 -1
  22. package/dist/lib/storage/store.js +1 -1
  23. package/dist/lib/utils.js +1 -1
  24. package/dist/lib/version.js +1 -0
  25. package/dist/logger/winston.js +1 -1
  26. package/dist/plugins/auth/auth.options.js +1 -0
  27. package/dist/plugins/auth/authzDynamic.js +1 -1
  28. package/dist/plugins/auth/authzLinid1.js +1 -1
  29. package/dist/plugins/auth/authzPerBranch.js +1 -1
  30. package/dist/plugins/auth/authzPerRoute.js +1 -1
  31. package/dist/plugins/auth/authzScope.js +1 -1
  32. package/dist/plugins/auth/crowdsec.js +1 -1
  33. package/dist/plugins/auth/fake.js +1 -1
  34. package/dist/plugins/auth/hmac.js +1 -1
  35. package/dist/plugins/auth/llng.js +1 -1
  36. package/dist/plugins/auth/openidconnect.js +1 -1
  37. package/dist/plugins/auth/rateLimit.js +1 -1
  38. package/dist/plugins/auth/token.js +1 -1
  39. package/dist/plugins/auth/totp.js +1 -1
  40. package/dist/plugins/auth/trustedProxy.js +1 -1
  41. package/dist/plugins/bcl.js +1 -1
  42. package/dist/plugins/bcl.options.js +1 -0
  43. package/dist/plugins/configApi.js +1 -1
  44. package/dist/plugins/demo/helloworld.js +1 -1
  45. package/dist/plugins/ldap/accountLifecycle.js +1 -1
  46. package/dist/plugins/ldap/bulkImport.js +1 -1
  47. package/dist/plugins/ldap/departmentSync.js +1 -1
  48. package/dist/plugins/ldap/enterpriseRules.js +1 -1
  49. package/dist/plugins/ldap/externalUsersInGroups.js +1 -1
  50. package/dist/plugins/ldap/flatGeneric.js +1 -1
  51. package/dist/plugins/ldap/groups.js +1 -1
  52. package/dist/plugins/ldap/ldap.options.js +1 -0
  53. package/dist/plugins/ldap/onChange.js +1 -1
  54. package/dist/plugins/ldap/organizations.js +1 -1
  55. package/dist/plugins/ldap/passwordPolicy.js +1 -1
  56. package/dist/plugins/ldap/raw.js +1 -1
  57. package/dist/plugins/ldap/trash.js +1 -1
  58. package/dist/plugins/metrics.js +1 -1
  59. package/dist/plugins/metrics.options.js +1 -0
  60. package/dist/plugins/rabbitmq.js +1 -1
  61. package/dist/plugins/rabbitmq.options.js +1 -0
  62. package/dist/plugins/scim/baseResolver.js +1 -1
  63. package/dist/plugins/scim/bulk.js +1 -1
  64. package/dist/plugins/scim/discovery.js +1 -1
  65. package/dist/plugins/scim/errors.js +1 -1
  66. package/dist/plugins/scim/filter.js +1 -1
  67. package/dist/plugins/scim/groups.js +1 -1
  68. package/dist/plugins/scim/mapping.js +1 -1
  69. package/dist/plugins/scim/patch.js +1 -1
  70. package/dist/plugins/scim/projection.js +1 -1
  71. package/dist/plugins/scim/scim.js +1 -1
  72. package/dist/plugins/scim/scim.options.js +1 -0
  73. package/dist/plugins/scim/users.js +1 -1
  74. package/dist/plugins/static.js +1 -1
  75. package/dist/plugins/static.options.js +1 -0
  76. package/dist/plugins/storage/file.js +1 -1
  77. package/dist/plugins/storage/ldap.js +1 -1
  78. package/dist/plugins/storage/postgres.js +1 -1
  79. package/dist/plugins/storage/valkey.js +1 -1
  80. package/dist/plugins/storage.js +1 -1
  81. package/dist/plugins/storage.options.js +1 -0
  82. package/dist/plugins/twake/appAccounts.options.js +1 -0
  83. package/dist/plugins/twake/appAccountsApi.js +1 -1
  84. package/dist/plugins/twake/appAccountsConsistency.js +1 -1
  85. package/dist/plugins/twake/calendar.js +1 -1
  86. package/dist/plugins/twake/calendar.options.js +1 -0
  87. package/dist/plugins/twake/calendarResources.js +1 -1
  88. package/dist/plugins/twake/cloudery.options.js +1 -0
  89. package/dist/plugins/twake/clouderyProvision.js +1 -1
  90. package/dist/plugins/twake/cozy.options.js +1 -0
  91. package/dist/plugins/twake/cozyProvision.js +1 -1
  92. package/dist/plugins/twake/drive.js +1 -1
  93. package/dist/plugins/twake/drive.options.js +1 -0
  94. package/dist/plugins/twake/groups.js +1 -1
  95. package/dist/plugins/twake/instances.js +1 -1
  96. package/dist/plugins/twake/james.js +1 -1
  97. package/dist/plugins/twake/james.options.js +1 -0
  98. package/dist/plugins/twake/lifecycleAttributes.js +1 -1
  99. package/dist/plugins/twake/lifecycleEvents.js +1 -1
  100. package/dist/plugins/twake/migrationProxy.js +1 -1
  101. package/dist/plugins/twake/migrationProxy.options.js +1 -0
  102. package/dist/plugins/twake/spaces.js +1 -1
  103. package/dist/plugins/twake/tombstone.js +1 -1
  104. package/dist/plugins/twake/twakeGroups.options.js +1 -0
  105. package/dist/plugins/twake/twakeInstances.options.js +1 -0
  106. package/dist/plugins/twake/twakeLifecycle.options.js +1 -0
  107. package/dist/plugins/twake/twakeSpaces.options.js +1 -0
  108. package/dist/plugins/twake/twakeTombstone.options.js +1 -0
  109. package/dist/plugins/weblogs.js +1 -1
  110. package/dist/src/abstract/ldapFlat.d.ts +28 -10
  111. package/dist/src/abstract/plugin.d.ts +10 -5
  112. package/dist/src/abstract/twakePlugin.d.ts +14 -4
  113. package/dist/src/bin/index.d.ts +17 -4
  114. package/dist/src/config/args.d.ts +2 -4
  115. package/dist/src/config/options.d.ts +89 -0
  116. package/dist/src/config/schema.d.ts +50 -1
  117. package/dist/src/hooks.d.ts +60 -22
  118. package/dist/src/lib/authz/base.d.ts +4 -51
  119. package/dist/src/lib/authz/composition.d.ts +2 -2
  120. package/dist/src/lib/entitySchema/validator.d.ts +63 -6
  121. package/dist/src/lib/errors.d.ts +56 -1
  122. package/dist/src/lib/expressFormatedResponses.d.ts +49 -7
  123. package/dist/src/lib/hookBus.d.ts +226 -0
  124. package/dist/src/lib/instanceProviders.d.ts +0 -8
  125. package/dist/src/lib/ldapActions.d.ts +11 -2
  126. package/dist/src/lib/parseConfig.d.ts +5 -0
  127. package/dist/src/lib/route.d.ts +99 -0
  128. package/dist/src/lib/utils.d.ts +37 -36
  129. package/dist/src/lib/version.d.ts +12 -0
  130. package/dist/src/plugins/auth/auth.options.d.ts +88 -0
  131. package/dist/src/plugins/auth/authzDynamic.d.ts +10 -1
  132. package/dist/src/plugins/auth/authzLinid1.d.ts +6 -0
  133. package/dist/src/plugins/auth/authzPerBranch.d.ts +9 -0
  134. package/dist/src/plugins/auth/authzPerRoute.d.ts +3 -0
  135. package/dist/src/plugins/auth/authzScope.d.ts +23 -14
  136. package/dist/src/plugins/auth/crowdsec.d.ts +5 -0
  137. package/dist/src/plugins/auth/fake.d.ts +3 -0
  138. package/dist/src/plugins/auth/hmac.d.ts +4 -0
  139. package/dist/src/plugins/auth/llng.d.ts +4 -0
  140. package/dist/src/plugins/auth/openidconnect.d.ts +7 -0
  141. package/dist/src/plugins/auth/rateLimit.d.ts +4 -0
  142. package/dist/src/plugins/auth/token.d.ts +3 -0
  143. package/dist/src/plugins/auth/totp.d.ts +5 -0
  144. package/dist/src/plugins/auth/trustedProxy.d.ts +4 -0
  145. package/dist/src/plugins/bcl.d.ts +3 -0
  146. package/dist/src/plugins/bcl.options.d.ts +8 -0
  147. package/dist/src/plugins/configApi.d.ts +24 -5
  148. package/dist/src/plugins/demo/helloworld.d.ts +8 -19
  149. package/dist/src/plugins/ldap/accountLifecycle.d.ts +17 -0
  150. package/dist/src/plugins/ldap/bulkImport.d.ts +6 -76
  151. package/dist/src/plugins/ldap/departmentSync.d.ts +1 -0
  152. package/dist/src/plugins/ldap/enterpriseRules.d.ts +8 -1
  153. package/dist/src/plugins/ldap/externalUsersInGroups.d.ts +4 -0
  154. package/dist/src/plugins/ldap/flatGeneric.d.ts +4 -0
  155. package/dist/src/plugins/ldap/groups.d.ts +27 -11
  156. package/dist/src/plugins/ldap/ldap.options.d.ts +75 -0
  157. package/dist/src/plugins/ldap/onChange.d.ts +10 -2
  158. package/dist/src/plugins/ldap/organizations.d.ts +16 -0
  159. package/dist/src/plugins/ldap/passwordPolicy.d.ts +32 -1
  160. package/dist/src/plugins/ldap/raw.d.ts +50 -19
  161. package/dist/src/plugins/ldap/trash.d.ts +6 -0
  162. package/dist/src/plugins/metrics.d.ts +3 -0
  163. package/dist/src/plugins/metrics.options.d.ts +8 -0
  164. package/dist/src/plugins/rabbitmq.d.ts +3 -0
  165. package/dist/src/plugins/rabbitmq.options.d.ts +8 -0
  166. package/dist/src/plugins/scim/baseResolver.d.ts +2 -1
  167. package/dist/src/plugins/scim/bulk.d.ts +6 -7
  168. package/dist/src/plugins/scim/discovery.d.ts +3 -0
  169. package/dist/src/plugins/scim/errors.d.ts +4 -1
  170. package/dist/src/plugins/scim/groups.d.ts +6 -4
  171. package/dist/src/plugins/scim/scim.d.ts +37 -3
  172. package/dist/src/plugins/scim/scim.options.d.ts +35 -0
  173. package/dist/src/plugins/scim/types.d.ts +2 -1
  174. package/dist/src/plugins/scim/users.d.ts +6 -7
  175. package/dist/src/plugins/static.d.ts +9 -0
  176. package/dist/src/plugins/static.options.d.ts +13 -0
  177. package/dist/src/plugins/storage.d.ts +12 -1
  178. package/dist/src/plugins/storage.options.d.ts +16 -0
  179. package/dist/src/plugins/twake/appAccounts.options.d.ts +13 -0
  180. package/dist/src/plugins/twake/appAccountsApi.d.ts +18 -0
  181. package/dist/src/plugins/twake/appAccountsConsistency.d.ts +8 -0
  182. package/dist/src/plugins/twake/calendar.d.ts +25 -2
  183. package/dist/src/plugins/twake/calendar.options.d.ts +19 -0
  184. package/dist/src/plugins/twake/cloudery.options.d.ts +26 -0
  185. package/dist/src/plugins/twake/clouderyProvision.d.ts +18 -0
  186. package/dist/src/plugins/twake/cozy.options.d.ts +23 -0
  187. package/dist/src/plugins/twake/cozyProvision.d.ts +14 -0
  188. package/dist/src/plugins/twake/drive.d.ts +7 -0
  189. package/dist/src/plugins/twake/drive.options.d.ts +15 -0
  190. package/dist/src/plugins/twake/groups.d.ts +30 -3
  191. package/dist/src/plugins/twake/instances.d.ts +43 -10
  192. package/dist/src/plugins/twake/james.d.ts +17 -0
  193. package/dist/src/plugins/twake/james.options.d.ts +21 -0
  194. package/dist/src/plugins/twake/lifecycleEvents.d.ts +12 -0
  195. package/dist/src/plugins/twake/migrationProxy.d.ts +11 -11
  196. package/dist/src/plugins/twake/migrationProxy.options.d.ts +16 -0
  197. package/dist/src/plugins/twake/spaces.d.ts +30 -0
  198. package/dist/src/plugins/twake/tombstone.d.ts +16 -14
  199. package/dist/src/plugins/twake/twakeGroups.options.d.ts +20 -0
  200. package/dist/src/plugins/twake/twakeInstances.options.d.ts +43 -0
  201. package/dist/src/plugins/twake/twakeLifecycle.options.d.ts +21 -0
  202. package/dist/src/plugins/twake/twakeSpaces.options.d.ts +19 -0
  203. package/dist/src/plugins/twake/twakeTombstone.options.d.ts +17 -0
  204. package/docs/README.md +1 -0
  205. package/docs/client-development/api/rest-api.md +9 -3
  206. package/docs/client-development/schemas/README.md +96 -32
  207. package/docs/plugin-development/README.md +45 -94
  208. package/docs/plugin-development/dependencies.md +11 -6
  209. package/docs/plugin-development/hooks.md +142 -23
  210. package/docs/plugin-development/openapi.md +14 -1
  211. package/docs/plugin-development/options.md +109 -0
  212. package/docs/plugin-development/routes.md +152 -0
  213. package/docs/plugin-development/testing.md +3 -3
  214. package/docs/usage/configuration.md +31 -24
  215. package/docs/usage/operations.md +19 -4
  216. package/docs/usage/plugins/integrations/groups.md +2 -2
  217. package/docs/usage/plugins/integrations/scim.md +12 -1
  218. package/docs/usage/plugins/integrations/spaces.md +1 -1
  219. package/docs/usage/plugins/ldap/enterprise-rules.md +10 -1
  220. package/docs/usage/plugins/ldap/flat-generic.md +4 -0
  221. package/docs/usage/plugins/ldap/raw.md +17 -1
  222. package/docs/usage/upgrading.md +207 -0
  223. package/package.json +358 -277
  224. package/static/browser/ldap-browser/LdapBrowser.js +8 -6
  225. package/static/browser/ldap-browser/LdapBrowser.js.map +1 -1
  226. package/static/browser/ldap-browser/api/RawApiClient.js +2 -0
  227. package/static/browser/ldap-browser/api/RawApiClient.js.map +1 -1
  228. package/static/browser/ldap-browser/components/EntryTree.js +9 -5
  229. package/static/browser/ldap-browser/components/EntryTree.js.map +1 -1
  230. package/static/browser/ldap-browser/components/EntryView.js +2 -0
  231. package/static/browser/ldap-browser/components/EntryView.js.map +1 -1
  232. package/static/browser/ldap-browser/schema.js +3 -2
  233. package/static/browser/ldap-browser/schema.js.map +1 -1
  234. package/static/browser/ldap-browser.esm.js +27 -18
  235. package/static/browser/ldap-browser.esm.js.map +1 -1
  236. package/static/browser/ldap-browser.js +27 -18
  237. package/static/browser/ldap-browser.js.map +1 -1
  238. package/static/browser/ldap-browser.min.js +1 -1
  239. package/static/browser/ldap-browser.min.js.map +1 -1
  240. package/static/browser/ldap-group-editor/LdapGroupEditor.js +8 -6
  241. package/static/browser/ldap-group-editor/LdapGroupEditor.js.map +1 -1
  242. package/static/browser/ldap-group-editor/api/GroupApiClient.js +1 -0
  243. package/static/browser/ldap-group-editor/api/GroupApiClient.js.map +1 -1
  244. package/static/browser/ldap-group-editor/components/CreateGroupModal.js +5 -1
  245. package/static/browser/ldap-group-editor/components/CreateGroupModal.js.map +1 -1
  246. package/static/browser/ldap-group-editor/components/GroupPropertyEditor.js +6 -3
  247. package/static/browser/ldap-group-editor/components/GroupPropertyEditor.js.map +1 -1
  248. package/static/browser/ldap-group-editor/components/GroupTree.js +6 -3
  249. package/static/browser/ldap-group-editor/components/GroupTree.js.map +1 -1
  250. package/static/browser/ldap-group-editor/components/MoveGroupModal.js +6 -3
  251. package/static/browser/ldap-group-editor/components/MoveGroupModal.js.map +1 -1
  252. package/static/browser/ldap-group-editor.esm.js +32 -16
  253. package/static/browser/ldap-group-editor.esm.js.map +1 -1
  254. package/static/browser/ldap-group-editor.js +32 -16
  255. package/static/browser/ldap-group-editor.js.map +1 -1
  256. package/static/browser/ldap-group-editor.min.js +1 -1
  257. package/static/browser/ldap-group-editor.min.js.map +1 -1
  258. package/static/browser/ldap-resource-editor/api/ResourceApiClient.js +3 -0
  259. package/static/browser/ldap-resource-editor/api/ResourceApiClient.js.map +1 -1
  260. package/static/browser/ldap-resource-editor/cache/CacheManager.js +3 -1
  261. package/static/browser/ldap-resource-editor/cache/CacheManager.js.map +1 -1
  262. package/static/browser/ldap-tree-viewer/LdapTreeViewer.js +6 -1
  263. package/static/browser/ldap-tree-viewer/LdapTreeViewer.js.map +1 -1
  264. package/static/browser/ldap-tree-viewer/api/LdapApiClient.js +2 -0
  265. package/static/browser/ldap-tree-viewer/api/LdapApiClient.js.map +1 -1
  266. package/static/browser/ldap-tree-viewer/components/TreeNode.js +4 -0
  267. package/static/browser/ldap-tree-viewer/components/TreeNode.js.map +1 -1
  268. package/static/browser/ldap-tree-viewer/components/TreeRoot.js +3 -0
  269. package/static/browser/ldap-tree-viewer/components/TreeRoot.js.map +1 -1
  270. package/static/browser/ldap-tree-viewer/store/Store.js +3 -1
  271. package/static/browser/ldap-tree-viewer/store/Store.js.map +1 -1
  272. package/static/browser/ldap-tree-viewer.esm.js +18 -2
  273. package/static/browser/ldap-tree-viewer.esm.js.map +1 -1
  274. package/static/browser/ldap-tree-viewer.js +18 -2
  275. package/static/browser/ldap-tree-viewer.js.map +1 -1
  276. package/static/browser/ldap-tree-viewer.min.js +1 -1
  277. package/static/browser/ldap-tree-viewer.min.js.map +1 -1
  278. package/static/browser/ldap-unit-editor/LdapUnitEditor.js +7 -5
  279. package/static/browser/ldap-unit-editor/LdapUnitEditor.js.map +1 -1
  280. package/static/browser/ldap-unit-editor/api/UnitApiClient.js +1 -0
  281. package/static/browser/ldap-unit-editor/api/UnitApiClient.js.map +1 -1
  282. package/static/browser/ldap-unit-editor/components/MoveUnitModal.js +7 -4
  283. package/static/browser/ldap-unit-editor/components/MoveUnitModal.js.map +1 -1
  284. package/static/browser/ldap-unit-editor/components/UnitPropertyEditor.js +7 -4
  285. package/static/browser/ldap-unit-editor/components/UnitPropertyEditor.js.map +1 -1
  286. package/static/browser/ldap-unit-editor/components/UnitTree.js +6 -3
  287. package/static/browser/ldap-unit-editor/components/UnitTree.js.map +1 -1
  288. package/static/browser/ldap-unit-editor.esm.js +28 -16
  289. package/static/browser/ldap-unit-editor.esm.js.map +1 -1
  290. package/static/browser/ldap-unit-editor.js +28 -16
  291. package/static/browser/ldap-unit-editor.js.map +1 -1
  292. package/static/browser/ldap-unit-editor.min.js +1 -1
  293. package/static/browser/ldap-unit-editor.min.js.map +1 -1
  294. package/static/browser/ldap-user-editor/LdapUserEditor.js +9 -7
  295. package/static/browser/ldap-user-editor/LdapUserEditor.js.map +1 -1
  296. package/static/browser/ldap-user-editor/api/UserApiClient.js +2 -0
  297. package/static/browser/ldap-user-editor/api/UserApiClient.js.map +1 -1
  298. package/static/browser/ldap-user-editor/cache/CacheManager.js +3 -1
  299. package/static/browser/ldap-user-editor/cache/CacheManager.js.map +1 -1
  300. package/static/browser/ldap-user-editor/components/MoveUserModal.js +7 -4
  301. package/static/browser/ldap-user-editor/components/MoveUserModal.js.map +1 -1
  302. package/static/browser/ldap-user-editor/components/PointerField.js +6 -1
  303. package/static/browser/ldap-user-editor/components/PointerField.js.map +1 -1
  304. package/static/browser/ldap-user-editor/components/UserEditor.js +10 -5
  305. package/static/browser/ldap-user-editor/components/UserEditor.js.map +1 -1
  306. package/static/browser/ldap-user-editor/components/UserList.js +8 -4
  307. package/static/browser/ldap-user-editor/components/UserList.js.map +1 -1
  308. package/static/browser/ldap-user-editor/components/UserTree.js +7 -3
  309. package/static/browser/ldap-user-editor/components/UserTree.js.map +1 -1
  310. package/static/browser/ldap-user-editor.esm.js +55 -30
  311. package/static/browser/ldap-user-editor.esm.js.map +1 -1
  312. package/static/browser/ldap-user-editor.js +55 -30
  313. package/static/browser/ldap-user-editor.js.map +1 -1
  314. package/static/browser/ldap-user-editor.min.js +1 -1
  315. package/static/browser/ldap-user-editor.min.js.map +1 -1
  316. package/static/browser/shared/components/DisposableComponent.js +3 -5
  317. package/static/browser/shared/components/DisposableComponent.js.map +1 -1
  318. package/static/browser/shared/components/Modal.js +2 -1
  319. package/static/browser/shared/components/Modal.js.map +1 -1
  320. package/static/browser/shared/components/StatusMessage.js +3 -2
  321. package/static/browser/shared/components/StatusMessage.js.map +1 -1
  322. package/static/browser/shared/utils/form.js.map +1 -1
  323. package/static/browser/shared/utils/hmac.js +1 -0
  324. package/static/browser/shared/utils/hmac.js.map +1 -1
  325. package/static/browser/shared/utils/totp.js +1 -0
  326. package/static/browser/shared/utils/totp.js.map +1 -1
  327. package/static/browser/shared.esm.js +9 -8
  328. package/static/browser/shared.esm.js.map +1 -1
  329. package/static/browser/shared.js +9 -8
  330. package/static/browser/shared.js.map +1 -1
  331. package/static/browser/shared.min.js +1 -1
  332. package/static/browser/shared.min.js.map +1 -1
  333. package/static/schemas/ad/groups.json +1 -1
  334. package/static/schemas/ad/users.json +3 -3
  335. package/static/schemas/example/organizations.json +2 -2
  336. package/static/schemas/example/users.json +2 -2
  337. package/static/schemas/obm/users.json +2 -2
  338. package/static/schemas/standard/groups.json +1 -1
  339. package/static/schemas/standard/users.json +2 -2
  340. package/static/schemas/twake/groups.json +4 -4
  341. package/static/schemas/twake/teamMailboxes.json +3 -3
  342. package/static/schemas/twake/users.json +7 -7
@@ -0,0 +1,99 @@
1
+ /**
2
+ * @module lib/route
3
+ * @author Xavier Guimard <xguimard@linagora.com>
4
+ *
5
+ * One declaration per HTTP route: its input schemas, the handler that
6
+ * receives the checked values, and what the OpenAPI document says of it.
7
+ * @group Libraries
8
+ */
9
+ import type { Static, TSchema } from '@sinclair/typebox';
10
+ import type { Express, NextFunction, Request, RequestHandler, Response } from 'express';
11
+ export type RouteMethod = 'get' | 'post' | 'put' | 'patch' | 'delete';
12
+ /** What the handler receives for a part it declared no schema for. */
13
+ type Input<T> = T extends TSchema ? Static<T> : unknown;
14
+ /** What a handler receives once its request has been checked. */
15
+ export interface RouteInput<P extends TSchema | undefined, Q extends TSchema | undefined, B extends TSchema | undefined> {
16
+ req: Request;
17
+ res: Response;
18
+ /** Express's own, for a handler that answers a failure itself */
19
+ next: NextFunction;
20
+ params: Input<P>;
21
+ query: Input<Q>;
22
+ body: Input<B>;
23
+ }
24
+ /**
25
+ * An answer: its schema, and the sentence the document gives it. A bare
26
+ * schema is described by its status (`Successful response`, `Bad request`…).
27
+ */
28
+ export interface RouteResponse {
29
+ schema: TSchema;
30
+ description?: string;
31
+ }
32
+ /** A route, as declared and as recorded for the OpenAPI document. */
33
+ export interface RouteDefinition<P extends TSchema | undefined = undefined, Q extends TSchema | undefined = undefined, B extends TSchema | undefined = undefined> {
34
+ method: RouteMethod;
35
+ path: string;
36
+ /** The path parameters, checked and converted from their string form */
37
+ params?: P;
38
+ /** The query parameters, checked and converted from their string form */
39
+ query?: Q;
40
+ /** The parsed body */
41
+ body?: B;
42
+ /**
43
+ * Whether a caller that does not accept JSON is refused before the handler
44
+ * (default). A route answering another media type sets it false.
45
+ */
46
+ json?: boolean;
47
+ /** Handlers run before the declaration's, as Express mounts them */
48
+ middleware?: RequestHandler | RequestHandler[];
49
+ /** The answers, for the OpenAPI document */
50
+ responses?: Partial<Record<number, TSchema | RouteResponse>>;
51
+ summary?: string;
52
+ description?: string;
53
+ tags?: string[];
54
+ handler: (input: RouteInput<P, Q, B>) => void | Promise<void>;
55
+ }
56
+ /** A route recorded on an app, with its schemas kept for the document. */
57
+ export type RegisteredRoute = Omit<RouteDefinition<TSchema, TSchema, TSchema>, 'handler' | 'middleware'>;
58
+ /**
59
+ * The routes `defineRoute` registered on an app, in declaration order.
60
+ *
61
+ * @param app the express app the plugin was given
62
+ * @returns its routes
63
+ */
64
+ export declare const registeredRoutes: (app: Express) => readonly RegisteredRoute[];
65
+ /** A route Express carries, as the stack spells it. */
66
+ export interface StackRoute {
67
+ method: string;
68
+ path: string;
69
+ }
70
+ /**
71
+ * The routes an app carries that `defineRoute` did not declare.
72
+ *
73
+ * The stack is walked at any depth, so a mounted router's routes are seen
74
+ * too. A route is matched on its method and path, which is what the
75
+ * declaration records; a router's routes are router-relative (`/nested`,
76
+ * whatever the mount path), as Express keeps no mount path on a router, and
77
+ * `app.all` comes back as `_ALL`.
78
+ *
79
+ * @param app the express app
80
+ * @returns the undeclared routes, in stack order
81
+ */
82
+ export declare const unregisteredRoutes: (app: Express) => StackRoute[];
83
+ /**
84
+ * Declare an HTTP route.
85
+ *
86
+ * The declared schemas are checked before the handler runs; a request that
87
+ * fails them is a {@link BadRequestError} naming every failing path, so the
88
+ * middleware answers it as any other client error. The handler receives the
89
+ * checked values and answers through `res`, as with `asyncHandler`, whose
90
+ * rejections it still forwards.
91
+ *
92
+ * The declaration is recorded on the app, with its schemas, for the OpenAPI
93
+ * document and for the check that no route escapes it.
94
+ *
95
+ * @param app the express app the plugin was given
96
+ * @param route the declaration
97
+ */
98
+ export declare const defineRoute: <P extends TSchema | undefined = undefined, Q extends TSchema | undefined = undefined, B extends TSchema | undefined = undefined>(app: Express, route: RouteDefinition<P, Q, B>) => void;
99
+ export {};
@@ -22,42 +22,7 @@ export declare function getCompiledRegex(pattern: string, flags?: string): RegEx
22
22
  * @returns The escaped string safe for use in RegExp
23
23
  */
24
24
  export declare function escapeRegex(str: string): string;
25
- /**
26
- * Run a hook under its plugin's name and its own, for the lines it logs:
27
- * what `launchHooks` does, for a caller walking the hooks itself.
28
- *
29
- * @param hook the registered function
30
- * @param fn its run
31
- * @returns what `fn` returns
32
- */
33
- export declare const runAsHookOwner: <T>(hook: Function, fn: () => T) => T;
34
- export declare const launchHooks: (hooks: Function[] | undefined, ...args: unknown[]) => Promise<void>;
35
- /**
36
- * Record the plugin a hook function belongs to.
37
- *
38
- * @param fn the registered function
39
- * @param plugin the plugin's instance name
40
- * @param hook the hook it is registered under
41
- */
42
- export declare const recordHookOwner: (fn: Function, plugin: string, hook: string) => void;
43
- /**
44
- * The plugin a hook function belongs to, and the hook it is registered
45
- * under, when `registerPlugin` registered it.
46
- *
47
- * @param fn a hook function
48
- * @returns its plugin's instance name and hook name, or undefined
49
- */
50
- export declare const hookOwner: (fn: Function) => {
51
- plugin: string;
52
- hook: string;
53
- } | undefined;
54
- /**
55
- * Whether an error is an authorization plugin's refusal, by the marker its
56
- * message carries: a plain `Error` wrapping it keeps the message only. Its
57
- * message names the branch, so the client is told `AUTHZ_REFUSED` instead.
58
- */
59
- export declare const isAuthzRefusal: (err: unknown) => boolean;
60
- export declare const launchHooksChained: <T>(hooks: Function[] | undefined, args: T) => Promise<T>;
25
+ export { hookOwner, recordHookOwner, runAsHookOwner } from './hookBus';
61
26
  export declare const transformSchemas: (schemas: string | Buffer, config: Config) => string;
62
27
  /**
63
28
  * Escape special characters in LDAP filter values according to RFC 4515
@@ -100,6 +65,12 @@ export declare function escapeLdapFilter(value: string): string;
100
65
  * ```
101
66
  */
102
67
  export declare function substringSearchFilter(match: string, attribute: string): string;
68
+ /**
69
+ * `pattern` with every `placeholder` replaced by `value`, taken literally:
70
+ * `String.replace` would expand `$&`, `$'`, `` $` `` and `$$` in a value
71
+ * that a request chose.
72
+ */
73
+ export declare function fillPattern(pattern: string, placeholder: string, value: string): string;
103
74
  /**
104
75
  * Escape special characters in LDAP DN attribute values according to RFC 4514
105
76
  * Prevents LDAP injection attacks by escaping characters that have special meaning in DNs
@@ -231,6 +202,36 @@ export declare function getRdn(dn: string): string;
231
202
  * ```
232
203
  */
233
204
  export declare function rdnValue(dn: string): string;
205
+ /**
206
+ * Read the name of an entry written as a DN: the value of its first RDN when
207
+ * that RDN asserts `attribute` alone, under `base` when one is given.
208
+ *
209
+ * The value is decoded exactly as {@link rdnValue} decodes it: it is the
210
+ * naming attribute's value, the one a write puts back in
211
+ * `attribute=…,base`.
212
+ *
213
+ * @param dn - The DN to read
214
+ * @param attribute - The attribute the first RDN must assert
215
+ * @param base - The branch the entry belongs to, when the DN names it whole
216
+ * @returns The name, or `null` when the RDN asserts another attribute, names
217
+ * another branch, or is no DN
218
+ *
219
+ * @example
220
+ * ```typescript
221
+ * assertedRdnValue('uid=Smith\\,John,ou=users,dc=example,dc=com', 'uid')
222
+ * // => 'Smith,John'
223
+ * ```
224
+ */
225
+ export declare function assertedRdnValue(dn: string, attribute: string, base?: string): string | null;
226
+ /**
227
+ * Whether `attribute=` starts `id`: the caller sent a DN rather than a bare
228
+ * naming value.
229
+ *
230
+ * Deciding this before `assertedRdnValue` matters: a string it refuses — a
231
+ * multi-valued RDN, another branch — is still a DN, and read as a bare value
232
+ * it would be written whole.
233
+ */
234
+ export declare function namesByDn(id: string, attribute: string): boolean;
234
235
  /**
235
236
  * Check if a DN is a child of another DN
236
237
  *
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The version of this package, read from the `package.json` that ships with
3
+ * it: the repository root when run from the sources, the installed package
4
+ * when run from the bundle. A build that moved the file elsewhere leaves it
5
+ * unknown rather than guessing.
6
+ *
7
+ * `start` is the directory the walk begins from; it defaults to this
8
+ * module's own and exists so the walk can be exercised on a fixture.
9
+ */
10
+ export declare function readVersion(start?: string): string | undefined;
11
+ /** The server's version, as its package declares it */
12
+ export declare const SERVER_VERSION: string | undefined;
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Authentication and authorization plugin options, see
3
+ * `docs/plugin-development/options.md`.
4
+ */
5
+ import type { AuthConfig, Config } from '../../config/args';
6
+ import { type OptionsOf } from '../../config/options';
7
+ export declare const tokenOptions: {
8
+ auth_token: import("../../config/options").ArrayOption;
9
+ };
10
+ export type TokenOptions = OptionsOf<typeof tokenOptions>;
11
+ export declare const fakeOptions: {
12
+ auth_fake_user: import("../../config/options").StringOption;
13
+ };
14
+ export type FakeOptions = OptionsOf<typeof fakeOptions>;
15
+ export declare const totpOptions: {
16
+ auth_totp: import("../../config/options").ArrayOption;
17
+ auth_totp_window: import("../../config/options").NumberOption;
18
+ auth_totp_step: import("../../config/options").NumberOption;
19
+ };
20
+ export type TotpOptions = OptionsOf<typeof totpOptions>;
21
+ export declare const hmacOptions: {
22
+ auth_hmac: import("../../config/options").ArrayOption;
23
+ auth_hmac_window: import("../../config/options").NumberOption;
24
+ };
25
+ export type HmacOptions = OptionsOf<typeof hmacOptions>;
26
+ export declare const llngOptions: {
27
+ llng_ini: import("../../config/options").StringOption;
28
+ llng_username_header: import("../../config/options").StringOption;
29
+ };
30
+ export type LlngOptions = OptionsOf<typeof llngOptions>;
31
+ export declare const perRouteOptions: {
32
+ authz_per_route: import("../../config/options").ArrayOption;
33
+ };
34
+ export type PerRouteOptions = OptionsOf<typeof perRouteOptions>;
35
+ export declare const perBranchOptions: {
36
+ authz_per_branch_config: import("../../config/options").JsonOption<AuthConfig>;
37
+ authz_per_branch_cache_ttl: import("../../config/options").NumberOption;
38
+ ldap_group_member_attribute: import("../../config/options").StringOption;
39
+ };
40
+ export type PerBranchOptions = OptionsOf<typeof perBranchOptions>;
41
+ export declare const dynamicOptions: {
42
+ authz_dynamic_bypass: import("../../config/options").ArrayOption;
43
+ authz_dynamic_base: import("../../config/options").StringOption;
44
+ authz_dynamic_cache_ttl: import("../../config/options").NumberOption;
45
+ authz_dynamic_token_attribute: import("../../config/options").StringOption;
46
+ authz_dynamic_config_attribute: import("../../config/options").StringOption;
47
+ authz_dynamic_tenant_attribute: import("../../config/options").StringOption;
48
+ authz_dynamic_reload_endpoint: import("../../config/options").BooleanOption;
49
+ };
50
+ export type DynamicOptions = OptionsOf<typeof dynamicOptions>;
51
+ export declare const linid1Options: {
52
+ authz_local_admin_attribute: import("../../config/options").StringOption;
53
+ authz_global_branch: import("../../config/options").ArrayOption;
54
+ authz_global_write_branch: import("../../config/options").ArrayOption;
55
+ authz_global_organization: import("../../config/options").StringOption;
56
+ };
57
+ export type Linid1Options = OptionsOf<typeof linid1Options>;
58
+ export declare const openidconnectOptions: {
59
+ oidc_server: import("../../config/options").StringOption;
60
+ oidc_username_claim: import("../../config/options").StringOption;
61
+ oidc_client_id: import("../../config/options").StringOption;
62
+ oidc_client_secret: import("../../config/options").StringOption;
63
+ base_url: import("../../config/options").StringOption;
64
+ };
65
+ export type OpenidconnectOptions = OptionsOf<typeof openidconnectOptions>;
66
+ export declare const rateLimitOptions: {
67
+ rate_limit_window_ms: import("../../config/options").NumberOption;
68
+ rate_limit_max: import("../../config/options").NumberOption;
69
+ };
70
+ export type RateLimitOptions = OptionsOf<typeof rateLimitOptions>;
71
+ export declare const crowdsecOptions: {
72
+ crowdsec_url: import("../../config/options").StringOption;
73
+ crowdsec_api_key: import("../../config/options").StringOption;
74
+ crowdsec_cache_ttl: import("../../config/options").NumberOption;
75
+ };
76
+ export type CrowdsecOptions = OptionsOf<typeof crowdsecOptions>;
77
+ export declare const trustedProxyOptions: {
78
+ trusted_proxy: import("../../config/options").ArrayOption;
79
+ trusted_proxy_auth_header: import("../../config/options").StringOption;
80
+ };
81
+ export type TrustedProxyOptions = OptionsOf<typeof trustedProxyOptions>;
82
+ /** The checked values for a caller that holds a Config instead of the plugin */
83
+ export declare function totpOptionsOf(config: Config): TotpOptions;
84
+ export declare function hmacOptionsOf(config: Config): HmacOptions;
85
+ export declare function perBranchOptionsOf(config: Config): PerBranchOptions;
86
+ export declare function dynamicOptionsOf(config: Config): DynamicOptions;
87
+ export declare function rateLimitOptionsOf(config: Config): RateLimitOptions;
88
+ export declare function crowdsecOptionsOf(config: Config): CrowdsecOptions;
@@ -51,6 +51,15 @@ export interface AuthzDynamicRequest extends DmRequest {
51
51
  authzToken?: TokenEntry;
52
52
  }
53
53
  export default class AuthzDynamic extends AuthBase {
54
+ static optionDefinitions: {
55
+ authz_dynamic_bypass: import("../../config/options").ArrayOption;
56
+ authz_dynamic_base: import("../../config/options").StringOption;
57
+ authz_dynamic_cache_ttl: import("../../config/options").NumberOption;
58
+ authz_dynamic_token_attribute: import("../../config/options").StringOption;
59
+ authz_dynamic_config_attribute: import("../../config/options").StringOption;
60
+ authz_dynamic_tenant_attribute: import("../../config/options").StringOption;
61
+ authz_dynamic_reload_endpoint: import("../../config/options").BooleanOption;
62
+ };
54
63
  name: string;
55
64
  roles: Role[];
56
65
  private tokens;
@@ -171,7 +180,7 @@ export default class AuthzDynamic extends AuthBase {
171
180
  */
172
181
  private activeToken;
173
182
  /**
174
- * Throw a ForbiddenError (403) if the token cannot perform `permission` on
183
+ * Throw an AuthzRefusedError (403) if the token cannot perform `permission` on
175
184
  * the branch containing `branchOrDn`. Any ACL entry that is `branchOrDn`
176
185
  * itself or a parent of it (sub-branch match) qualifies.
177
186
  *
@@ -14,6 +14,12 @@ interface CachedPermissions {
14
14
  timestamp: number;
15
15
  }
16
16
  export default class AuthzLinid1 extends AuthzBase {
17
+ static optionDefinitions: {
18
+ authz_local_admin_attribute: import("../../config/options").StringOption;
19
+ authz_global_branch: import("../../config/options").ArrayOption;
20
+ authz_global_write_branch: import("../../config/options").ArrayOption;
21
+ authz_global_organization: import("../../config/options").StringOption;
22
+ };
17
23
  name: string;
18
24
  permissionsCache: Map<string, CachedPermissions>;
19
25
  constructor(server: DM);
@@ -16,6 +16,11 @@ interface CachedGroups {
16
16
  timestamp: number;
17
17
  }
18
18
  export default class AuthzPerBranch extends AuthzBase {
19
+ static optionDefinitions: {
20
+ authz_per_branch_config: import("../../config/options").JsonOption<AuthConfig>;
21
+ authz_per_branch_cache_ttl: import("../../config/options").NumberOption;
22
+ ldap_group_member_attribute: import("../../config/options").StringOption;
23
+ };
19
24
  name: string;
20
25
  authConfig?: AuthConfig;
21
26
  groupCache: Map<string, CachedGroups>;
@@ -30,7 +35,11 @@ export default class AuthzPerBranch extends AuthzBase {
30
35
  /** `authConfig.groups` keyed by normalized DN, and the object it was built from. */
31
36
  private groupRulesIndex?;
32
37
  hooks: AuthzBase['hooks'] & Pick<Hooks, 'ldapadddone' | 'ldapmodifydone' | 'ldapdeletedone'>;
38
+ /** What the classes above declared, read once this one is constructed */
39
+ private readonly declaredByBase;
33
40
  constructor(server: DM);
41
+ /** The attribute a group lists its members in */
42
+ private get memberAttribute();
34
43
  /**
35
44
  * Whether a modify can change which groups a uid belongs to: it touches
36
45
  * the member attribute, or the attribute a uid is resolved by.
@@ -11,6 +11,9 @@ import type { Express } from 'express';
11
11
  import DmPlugin, { type Role } from '../../abstract/plugin';
12
12
  export declare function globToRegex(glob: string): RegExp;
13
13
  export default class AuthzPerRoute extends DmPlugin {
14
+ static optionDefinitions: {
15
+ authz_per_route: import("../../config/options").ArrayOption;
16
+ };
14
17
  name: string;
15
18
  roles: Role[];
16
19
  private rules;
@@ -1,19 +1,28 @@
1
- /**
2
- * @module plugins/auth/authzScope
3
- * @author Xavier Guimard <xguimard@linagora.com>
4
- *
5
- * Tells a client what the signed-in administrator may actually do, before it
6
- * offers them a button that will fail.
7
- *
8
- * In a local-administration model the scope *is* the interface: a manager
9
- * administers a few branches of the tree and nothing else, and an application
10
- * that cannot name those branches leaves them guessing. This endpoint answers
11
- * both halves — which branches, and which entities can be created in them —
12
- * by asking the authorization plugin in force, whichever one that is.
13
- * @group Plugins
14
- */
15
1
  import type { Express } from 'express';
16
2
  import DmPlugin, { type Role } from '../../abstract/plugin';
3
+ export declare const ScopeResponse: import("@sinclair/typebox").TObject<{
4
+ user: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
5
+ unrestricted: import("@sinclair/typebox").TBoolean;
6
+ described: import("@sinclair/typebox").TBoolean;
7
+ source: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
8
+ sources: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
9
+ branches: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
10
+ dn: import("@sinclair/typebox").TString;
11
+ read: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
12
+ write: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
13
+ delete: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
14
+ name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
15
+ path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
16
+ }>>;
17
+ transit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
18
+ linksAnyDomain: import("@sinclair/typebox").TBoolean;
19
+ passwordPolicies: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
20
+ entities: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
21
+ name: import("@sinclair/typebox").TString;
22
+ base: import("@sinclair/typebox").TString;
23
+ create: import("@sinclair/typebox").TBoolean;
24
+ }>>;
25
+ }>;
17
26
  export default class AuthzScope extends DmPlugin {
18
27
  name: string;
19
28
  roles: Role[];
@@ -16,6 +16,11 @@
16
16
  import type { Express } from 'express';
17
17
  import DmPlugin, { Role } from '../../abstract/plugin';
18
18
  export default class CrowdSec extends DmPlugin {
19
+ static optionDefinitions: {
20
+ crowdsec_url: import("../../config/options").StringOption;
21
+ crowdsec_api_key: import("../../config/options").StringOption;
22
+ crowdsec_cache_ttl: import("../../config/options").NumberOption;
23
+ };
19
24
  name: string;
20
25
  roles: Role[];
21
26
  private apiUrl;
@@ -10,6 +10,9 @@ import type { Response } from 'express';
10
10
  import AuthBase, { type DmRequest } from '../../lib/auth/base';
11
11
  import type { Role } from '../../abstract/plugin';
12
12
  export default class AuthFake extends AuthBase {
13
+ static optionDefinitions: {
14
+ auth_fake_user: import("../../config/options").StringOption;
15
+ };
13
16
  name: string;
14
17
  roles: Role[];
15
18
  private readonly user;
@@ -2,6 +2,10 @@ import type { Response } from 'express';
2
2
  import AuthBase, { type DmRequest } from '../../lib/auth/base';
3
3
  import type { Role } from '../../abstract/plugin';
4
4
  export default class AuthHmac extends AuthBase {
5
+ static optionDefinitions: {
6
+ auth_hmac: import("../../config/options").ArrayOption;
7
+ auth_hmac_window: import("../../config/options").NumberOption;
8
+ };
5
9
  protected knownIdentities(): string[];
6
10
  protected identitySource(): string;
7
11
  name: string;
@@ -11,6 +11,10 @@ import AuthBase, { DmRequest } from '../../lib/auth/base';
11
11
  import type { Role } from '../../abstract/plugin';
12
12
  type LlngHandler = typeof import('lemonldap-ng-handler');
13
13
  export default class AuthLLNG extends AuthBase {
14
+ static optionDefinitions: {
15
+ llng_ini: import("../../config/options").StringOption;
16
+ llng_username_header: import("../../config/options").StringOption;
17
+ };
14
18
  name: string;
15
19
  roles: Role[];
16
20
  private handler?;
@@ -4,6 +4,13 @@ import AuthBase, { DmRequest } from '../../lib/auth/base';
4
4
  import { type Role } from '../../abstract/plugin';
5
5
  import { DM } from '../../bin';
6
6
  export default class OpenIDConnect extends AuthBase {
7
+ static optionDefinitions: {
8
+ oidc_server: import("../../config/options").StringOption;
9
+ oidc_username_claim: import("../../config/options").StringOption;
10
+ oidc_client_id: import("../../config/options").StringOption;
11
+ oidc_client_secret: import("../../config/options").StringOption;
12
+ base_url: import("../../config/options").StringOption;
13
+ };
7
14
  name: string;
8
15
  configApiKey: string;
9
16
  roles: Role[];
@@ -15,6 +15,10 @@
15
15
  import type { Express } from 'express';
16
16
  import DmPlugin, { type Role } from '../../abstract/plugin';
17
17
  export default class RateLimit extends DmPlugin {
18
+ static optionDefinitions: {
19
+ rate_limit_window_ms: import("../../config/options").NumberOption;
20
+ rate_limit_max: import("../../config/options").NumberOption;
21
+ };
18
22
  name: string;
19
23
  roles: Role[];
20
24
  private store;
@@ -9,6 +9,9 @@ import type { Response } from 'express';
9
9
  import AuthBase, { type DmRequest } from '../../lib/auth/base';
10
10
  import type { Role } from '../../abstract/plugin';
11
11
  export default class AuthToken extends AuthBase {
12
+ static optionDefinitions: {
13
+ auth_token: import("../../config/options").ArrayOption;
14
+ };
12
15
  protected knownIdentities(): string[];
13
16
  protected identitySource(): string;
14
17
  name: string;
@@ -2,6 +2,11 @@ import type { Response } from 'express';
2
2
  import AuthBase, { type DmRequest } from '../../lib/auth/base';
3
3
  import type { Role } from '../../abstract/plugin';
4
4
  export default class AuthTotp extends AuthBase {
5
+ static optionDefinitions: {
6
+ auth_totp: import("../../config/options").ArrayOption;
7
+ auth_totp_window: import("../../config/options").NumberOption;
8
+ auth_totp_step: import("../../config/options").NumberOption;
9
+ };
5
10
  protected knownIdentities(): string[];
6
11
  protected identitySource(): string;
7
12
  name: string;
@@ -34,6 +34,10 @@ declare global {
34
34
  }
35
35
  }
36
36
  export default class TrustedProxy extends DmPlugin {
37
+ static optionDefinitions: {
38
+ trusted_proxy: import("../../config/options").ArrayOption;
39
+ trusted_proxy_auth_header: import("../../config/options").StringOption;
40
+ };
37
41
  name: string;
38
42
  roles: Role[];
39
43
  private trustedNetworks;
@@ -20,6 +20,9 @@ import DmPlugin from '../abstract/plugin';
20
20
  import type { DM } from '../bin';
21
21
  import type { OidcLogoutToken, OidcSessionClaims } from '../hooks';
22
22
  export default class Bcl extends DmPlugin {
23
+ static optionDefinitions: {
24
+ bcl_retention: import("../config/options").NumberOption;
25
+ };
23
26
  name: string;
24
27
  dependencies: {
25
28
  storage: string;
@@ -0,0 +1,8 @@
1
+ /** Back-Channel Logout plugin options. */
2
+ import type { Config } from '../config/args';
3
+ import { type OptionsOf } from '../config/options';
4
+ export declare const bclOptions: {
5
+ bcl_retention: import("../config/options").NumberOption;
6
+ };
7
+ export type BclOptions = OptionsOf<typeof bclOptions>;
8
+ export declare function bclOptionsOf(config: Config): BclOptions;
@@ -10,16 +10,26 @@
10
10
  */
11
11
  import type { Express } from 'express';
12
12
  import DmPlugin, { type Role } from '../abstract/plugin';
13
+ interface ConfigApiResponse {
14
+ apiPrefix: string;
15
+ ldapBase: string;
16
+ features: Record<string, unknown>;
17
+ /** Absent when the version could not be read at start-up */
18
+ version?: string;
19
+ }
20
+ /** The body of `GET /v1/config`, `version` left out when it is unknown. */
21
+ export declare function configApiResponse(apiPrefix: string, ldapBase: string, features: Record<string, unknown>, version: string | undefined): ConfigApiResponse;
13
22
  /**
14
23
  * @openapi-component
15
24
  * Config:
16
25
  * type: object
17
26
  * description: |
18
- * Aggregated server configuration. The top-level fields are always
19
- * present; `features` is a dynamic map whose keys are the names of
20
- * loaded plugins that declare the `configurable` role. Each plugin
21
- * contributes an arbitrary sub-object — consult the individual plugin
22
- * documentation for its exact shape.
27
+ * Aggregated server configuration. `apiPrefix`, `ldapBase` and
28
+ * `features` are always present; `version` is present unless the server
29
+ * could not read it at start-up; `features` is a dynamic map whose keys
30
+ * are the names of loaded plugins that declare the `configurable` role.
31
+ * Each plugin contributes an arbitrary sub-object — consult the
32
+ * individual plugin documentation for its exact shape.
23
33
  * additionalProperties: true
24
34
  * properties:
25
35
  * apiPrefix:
@@ -30,6 +40,13 @@ import DmPlugin, { type Role } from '../abstract/plugin';
30
40
  * type: string
31
41
  * description: The root LDAP suffix used by this server.
32
42
  * example: dc=example,dc=com
43
+ * version:
44
+ * type: string
45
+ * description: |
46
+ * The server's version, as its package declares it. A client reads it
47
+ * to tell an administrator the server is older than it supports; a
48
+ * server that cannot tell its version leaves the field out.
49
+ * example: 1.2.1
33
50
  * features:
34
51
  * type: object
35
52
  * description: |
@@ -52,6 +69,7 @@ import DmPlugin, { type Role } from '../abstract/plugin';
52
69
  * example:
53
70
  * apiPrefix: /api
54
71
  * ldapBase: dc=example,dc=com
72
+ * version: 1.2.1
55
73
  * features:
56
74
  * ldapGroups:
57
75
  * enabled: true
@@ -73,3 +91,4 @@ export default class ConfigApi extends DmPlugin {
73
91
  */
74
92
  private collectPluginConfigs;
75
93
  }
94
+ export {};
@@ -6,26 +6,15 @@
6
6
  import type { Express } from 'express';
7
7
  import DmPlugin, { type Role } from '../../abstract/plugin';
8
8
  /**
9
- * @openapi-component
10
- * Hello:
11
- * type: object
12
- * description: Response returned by the hello-world demo endpoint.
13
- * properties:
14
- * message:
15
- * type: string
16
- * description: Static greeting string.
17
- * example: Hello
18
- * hookResults:
19
- * type: array
20
- * description: |
21
- * Results collected from every function registered on the `hello`
22
- * hook. Empty when no hook listeners are installed.
23
- * items: {}
24
- * example: []
25
- * example:
26
- * message: Hello
27
- * hookResults: []
9
+ * The answer of the hello-world endpoint.
10
+ *
11
+ * Exported because the OpenAPI generator reads it without running the
12
+ * plugin, as it reads every schema a route declares.
28
13
  */
14
+ export declare const HelloResponse: import("@sinclair/typebox").TObject<{
15
+ message: import("@sinclair/typebox").TString;
16
+ hookResults: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnknown>;
17
+ }>;
29
18
  export default class HelloWorld extends DmPlugin {
30
19
  name: string;
31
20
  roles: Role[];