ldap-rest 0.1.4 → 0.1.6

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 (51) hide show
  1. package/README.md +31 -21
  2. package/docs/README.md +23 -486
  3. package/docs/{DEVELOPER_GUIDE.md → client-development/README.md} +24 -24
  4. package/docs/client-development/api/README.md +75 -0
  5. package/docs/client-development/browser/README.md +65 -0
  6. package/docs/{plugins/DEVELOPMENT.md → plugin-development/README.md} +4 -9
  7. package/docs/plugin-development/hooks.md +18 -0
  8. package/docs/usage/README.md +89 -0
  9. package/docs/usage/configuration.md +375 -0
  10. package/docs/usage/plugins/README.md +87 -0
  11. package/docs/usage/plugins/auth/README.md +65 -0
  12. package/docs/usage/plugins/auth/crowdsec.md +95 -0
  13. package/docs/usage/plugins/auth/hmac.md +293 -0
  14. package/docs/usage/plugins/auth/llng.md +99 -0
  15. package/docs/usage/plugins/auth/oidc.md +167 -0
  16. package/docs/usage/plugins/auth/rate-limit.md +62 -0
  17. package/docs/usage/plugins/auth/token.md +136 -0
  18. package/docs/usage/plugins/auth/totp.md +213 -0
  19. package/docs/usage/plugins/auth/trusted-proxy.md +127 -0
  20. package/docs/usage/plugins/integrations/README.md +42 -0
  21. package/docs/usage/plugins/ldap/README.md +79 -0
  22. package/docs/usage/troubleshooting.md +105 -0
  23. package/package.json +9 -1
  24. package/docs/authentication.md +0 -1194
  25. /package/docs/{OPENAPI.md → client-development/api/openapi.md} +0 -0
  26. /package/docs/{api/REFERENCE.md → client-development/api/reference.md} +0 -0
  27. /package/docs/{api/REST_API.md → client-development/api/rest-api.md} +0 -0
  28. /package/docs/{browser/LIBRARIES.md → client-development/browser/libraries.md} +0 -0
  29. /package/docs/{examples/EXAMPLES.md → client-development/examples/README.md} +0 -0
  30. /package/docs/{examples → client-development/examples/ldif}/twake-mailbox-type-nomenclature.ldif +0 -0
  31. /package/docs/{examples → client-development/examples/ldif}/twake-mailbox-type-schema-amendment.ldif +0 -0
  32. /package/docs/{schemas/SCHEMAS.md → client-development/schemas/README.md} +0 -0
  33. /package/docs/{PLUGIN_DEPENDENCIES.md → plugin-development/dependencies.md} +0 -0
  34. /package/docs/{testing-with-embedded-ldap.md → plugin-development/testing.md} +0 -0
  35. /package/docs/{presenterm.md → presentations/en.md} +0 -0
  36. /package/docs/{presenterm-fr.md → presentations/fr.md} +0 -0
  37. /package/docs/{authzLinid1.md → usage/plugins/auth/authz-linid1.md} +0 -0
  38. /package/docs/{authzPerBranch.md → usage/plugins/auth/authz-per-branch.md} +0 -0
  39. /package/docs/{twakeAppAccountsApi.md → usage/plugins/integrations/app-accounts.md} +0 -0
  40. /package/docs/{twakeCalendarResources.md → usage/plugins/integrations/calendar-resources.md} +0 -0
  41. /package/docs/{twakeJames.md → usage/plugins/integrations/james-mail.md} +0 -0
  42. /package/docs/{jamesTeamMailboxes.md → usage/plugins/integrations/james-mailboxes.md} +0 -0
  43. /package/docs/{ldapBulkImport.md → usage/plugins/ldap/bulk-import.md} +0 -0
  44. /package/docs/{ldapExternalUsersInGroups.md → usage/plugins/ldap/external-users.md} +0 -0
  45. /package/docs/{ldapFlatGeneric.md → usage/plugins/ldap/flat-generic.md} +0 -0
  46. /package/docs/{ldapGroups.md → usage/plugins/ldap/groups.md} +0 -0
  47. /package/docs/{onChange.md → usage/plugins/ldap/on-change.md} +0 -0
  48. /package/docs/{ldapOrganizations.md → usage/plugins/ldap/organizations.md} +0 -0
  49. /package/docs/{ldapTrash.md → usage/plugins/ldap/trash.md} +0 -0
  50. /package/docs/{static.md → usage/plugins/utilities/static.md} +0 -0
  51. /package/docs/{weblogs.md → usage/plugins/utilities/weblogs.md} +0 -0
@@ -11,17 +11,17 @@ Welcome to the LDAP-Rest Developer Guide! This guide helps you build web applica
11
11
 
12
12
  ### 📚 Core Documentation
13
13
 
14
- - **[REST API Documentation](./api/REST_API.md)** - Complete API reference (Config, Users, Groups, Organizations)
15
- - **[Browser Libraries](./browser/LIBRARIES.md)** - LdapTreeViewer and LdapUserEditor
16
- - **[JSON Schemas](./schemas/SCHEMAS.md)** - Schema structure and validation
17
- - **[Integration Examples](./examples/EXAMPLES.md)** - React, Vue.js, Vanilla JavaScript examples
18
- - **[Plugin Development](./plugins/DEVELOPMENT.md)** - Create your own plugins
14
+ - **[REST API Documentation](./api/rest-api.md)** - Complete API reference (Config, Users, Groups, Organizations)
15
+ - **[Browser Libraries](./browser/libraries.md)** - LdapTreeViewer and LdapUserEditor
16
+ - **[JSON Schemas](./schemas/README.md)** - Schema structure and validation
17
+ - **[Integration Examples](./examples/README.md)** - React, Vue.js, Vanilla JavaScript examples
18
+ - **[Plugin Development](../plugin-development/README.md)** - Create your own plugins
19
19
 
20
20
  ### 🔧 Reference
21
21
 
22
- - **[API Reference](./api/REFERENCE.md)** - Complete API reference with all endpoints
23
- - [Authentication](./api/REST_API.md#authentication) - OpenID, Token, LemonLDAP::NG
24
- - [Troubleshooting](./api/REFERENCE.md#troubleshooting) - Common issues and solutions
22
+ - **[API Reference](./api/reference.md)** - Complete API reference with all endpoints
23
+ - [Authentication](./api/rest-api.md#authentication) - OpenID, Token, LemonLDAP::NG
24
+ - [Troubleshooting](./api/reference.md#troubleshooting) - Common issues and solutions
25
25
 
26
26
  ---
27
27
 
@@ -152,14 +152,14 @@ console.log(config);
152
152
 
153
153
  ### API Documentation
154
154
 
155
- - **[REST API Guide](./api/REST_API.md)**
155
+ - **[REST API Guide](./api/rest-api.md)**
156
156
  - Configuration API
157
157
  - Organizations API
158
158
  - Users API
159
159
  - Groups API
160
160
  - Authentication
161
161
 
162
- - **[Complete API Reference](./api/REFERENCE.md)**
162
+ - **[Complete API Reference](./api/reference.md)**
163
163
  - All endpoints with examples
164
164
  - Request/response formats
165
165
  - Error codes
@@ -167,7 +167,7 @@ console.log(config);
167
167
 
168
168
  ### Browser Libraries
169
169
 
170
- - **[Browser Libraries Guide](./browser/LIBRARIES.md)**
170
+ - **[Browser Libraries Guide](./browser/libraries.md)**
171
171
  - LdapTreeViewer - Interactive LDAP tree
172
172
  - LdapUserEditor - Complete user editor
173
173
  - Configuration options
@@ -176,7 +176,7 @@ console.log(config);
176
176
 
177
177
  ### Schemas
178
178
 
179
- - **[JSON Schemas Guide](./schemas/SCHEMAS.md)**
179
+ - **[JSON Schemas Guide](./schemas/README.md)**
180
180
  - Schema structure
181
181
  - Entity metadata
182
182
  - Attribute types
@@ -186,7 +186,7 @@ console.log(config);
186
186
 
187
187
  ### Integration
188
188
 
189
- - **[Integration Examples](./examples/EXAMPLES.md)**
189
+ - **[Integration Examples](./examples/README.md)**
190
190
  - React application
191
191
  - Vue.js application
192
192
  - Vanilla JavaScript
@@ -195,7 +195,7 @@ console.log(config);
195
195
 
196
196
  ### Plugin Development
197
197
 
198
- - **[Plugin Development Guide](./plugins/DEVELOPMENT.md)**
198
+ - **[Plugin Development Guide](../plugin-development/README.md)**
199
199
  - Creating plugins
200
200
  - Custom configuration
201
201
  - Hooks system
@@ -234,7 +234,7 @@ LDAP-Rest uses JSON schemas to define LDAP entity structure:
234
234
  }
235
235
  ```
236
236
 
237
- See [JSON Schemas Guide](./schemas/SCHEMAS.md) for details.
237
+ See [JSON Schemas Guide](./schemas/README.md) for details.
238
238
 
239
239
  ### Dynamic Configuration
240
240
 
@@ -252,7 +252,7 @@ const usersEndpoint = config.features.ldapFlatGeneric.flatResources.find(
252
252
  const users = await fetch(usersEndpoint).then(r => r.json());
253
253
  ```
254
254
 
255
- See [REST API Guide](./api/REST_API.md) for details.
255
+ See [REST API Guide](./api/rest-api.md) for details.
256
256
 
257
257
  ### Plugin-Based Extensibility
258
258
 
@@ -263,25 +263,25 @@ Extend LDAP-Rest with custom plugins that:
263
263
  - Integrate external systems
264
264
  - Implement custom logic
265
265
 
266
- See [Plugin Development Guide](./plugins/DEVELOPMENT.md) for details.
266
+ See [Plugin Development Guide](../plugin-development/README.md) for details.
267
267
 
268
268
  ---
269
269
 
270
270
  ## Next Steps
271
271
 
272
- 1. **Learn the API** - Read the [REST API Guide](./api/REST_API.md)
273
- 2. **Try the Libraries** - Check the [Browser Libraries Guide](./browser/LIBRARIES.md)
274
- 3. **See Examples** - Explore [Integration Examples](./examples/EXAMPLES.md)
275
- 4. **Build a Plugin** - Follow the [Plugin Development Guide](./plugins/DEVELOPMENT.md)
272
+ 1. **Learn the API** - Read the [REST API Guide](./api/rest-api.md)
273
+ 2. **Try the Libraries** - Check the [Browser Libraries Guide](./browser/libraries.md)
274
+ 3. **See Examples** - Explore [Integration Examples](./examples/README.md)
275
+ 4. **Build a Plugin** - Follow the [Plugin Development Guide](../plugin-development/README.md)
276
276
 
277
277
  ---
278
278
 
279
279
  ## Resources
280
280
 
281
281
  - [GitHub Repository](https://github.com/linagora/ldap-rest)
282
- - [Contributing Guide](../CONTRIBUTING.md)
283
- - [Plugin Development](../src/plugins/README.md)
284
- - [Hooks Reference](../HOOKS.md)
282
+ - [Contributing Guide](../../CONTRIBUTING.md)
283
+ - [Plugin Development](../plugin-development/README.md)
284
+ - [Hooks Reference](../plugin-development/hooks.md)
285
285
 
286
286
  ---
287
287
 
@@ -0,0 +1,75 @@
1
+ # REST API
2
+
3
+ LDAP-Rest REST API documentation.
4
+
5
+ ## Overview
6
+
7
+ The LDAP-Rest REST API exposes endpoints for managing LDAP entities.
8
+
9
+ ## Documentation
10
+
11
+ - **[rest-api.md](rest-api.md)** - Complete API usage guide
12
+ - **[reference.md](reference.md)** - Technical reference (HTTP codes, headers, URL encoding)
13
+ - **[openapi.md](openapi.md)** - OpenAPI specification
14
+
15
+ ## Authentication
16
+
17
+ All API requests require authentication. See the [authentication documentation](../../usage/plugins/auth/README.md).
18
+
19
+ ### Token Example
20
+
21
+ ```bash
22
+ curl -H "Authorization: Bearer your-token" \
23
+ http://localhost:8081/api/v1/ldap/users
24
+ ```
25
+
26
+ ## Main Endpoints
27
+
28
+ ### Entities (ldapFlatGeneric)
29
+
30
+ ```
31
+ GET /api/v1/ldap/{pluralName} # List
32
+ GET /api/v1/ldap/{pluralName}/{id} # Get
33
+ POST /api/v1/ldap/{pluralName} # Create
34
+ PUT /api/v1/ldap/{pluralName}/{id} # Modify
35
+ DELETE /api/v1/ldap/{pluralName}/{id} # Delete
36
+ ```
37
+
38
+ ### Groups
39
+
40
+ ```
41
+ GET /api/v1/ldap/groups
42
+ GET /api/v1/ldap/groups/{cn}
43
+ POST /api/v1/ldap/groups
44
+ PUT /api/v1/ldap/groups/{cn}
45
+ DELETE /api/v1/ldap/groups/{cn}
46
+ ```
47
+
48
+ ### Organizations
49
+
50
+ ```
51
+ GET /api/v1/ldap/organizations/top
52
+ GET /api/v1/ldap/organizations/{dn}/subnodes
53
+ POST /api/v1/ldap/organizations
54
+ PUT /api/v1/ldap/organizations/{dn}
55
+ DELETE /api/v1/ldap/organizations/{dn}
56
+ ```
57
+
58
+ ### Configuration
59
+
60
+ ```
61
+ GET /api/v1/config # Available capabilities and schemas
62
+ ```
63
+
64
+ ## Response Codes
65
+
66
+ | Code | Description |
67
+ | ---- | ------------------------- |
68
+ | 200 | Success |
69
+ | 201 | Created |
70
+ | 400 | Invalid request |
71
+ | 401 | Not authenticated |
72
+ | 403 | Access forbidden |
73
+ | 404 | Not found |
74
+ | 409 | Conflict (existing entry) |
75
+ | 500 | Server error |
@@ -0,0 +1,65 @@
1
+ # Browser Libraries
2
+
3
+ Web components for integrating LDAP-Rest into your applications.
4
+
5
+ ## Overview
6
+
7
+ LDAP-Rest provides reusable web components for LDAP management.
8
+
9
+ ## Documentation
10
+
11
+ - **[libraries.md](libraries.md)** - Complete component documentation
12
+
13
+ ## Available Components
14
+
15
+ | Component | Description |
16
+ | -------------------- | ------------------------------ |
17
+ | `LdapTreeViewer` | LDAP tree navigation |
18
+ | `LdapUserEditor` | User editing |
19
+ | `LdapGroupEditor` | Group management |
20
+ | `LdapUnitEditor` | Organizational unit management |
21
+ | `LdapResourceEditor` | Resource management |
22
+
23
+ ## Utilities
24
+
25
+ | Module | Description |
26
+ | ----------------------------- | ------------------------------ |
27
+ | `browser-shared-utils-totp` | TOTP client for authentication |
28
+ | `browser-shared-utils-hmac` | HMAC client for authentication |
29
+ | `browser-shared-utils-dom` | DOM utilities |
30
+ | `browser-shared-utils-form` | Form utilities |
31
+ | `browser-shared-utils-schema` | JSON schema utilities |
32
+
33
+ ## Installation
34
+
35
+ ```bash
36
+ npm install ldap-rest
37
+ ```
38
+
39
+ ## Import
40
+
41
+ ```typescript
42
+ // Components
43
+ import { LdapTreeViewer, LdapUserEditor } from 'ldap-rest/browser';
44
+
45
+ // Utilities
46
+ import { TotpAuthClient } from 'ldap-rest/browser-shared-utils-totp';
47
+ import { HmacAuthClient } from 'ldap-rest/browser-shared-utils-hmac';
48
+ ```
49
+
50
+ ## Quick Example
51
+
52
+ ```typescript
53
+ import { LdapTreeViewer } from 'ldap-rest/browser';
54
+
55
+ const viewer = new LdapTreeViewer({
56
+ apiUrl: 'http://localhost:8081/api/v1',
57
+ container: document.getElementById('tree'),
58
+ });
59
+
60
+ viewer.render();
61
+ ```
62
+
63
+ ## Demos
64
+
65
+ Interactive examples are available in the [examples](../examples/README.md) folder.
@@ -205,15 +205,10 @@ Create a standalone file anywhere on your system, e.g., `/opt/custom-plugins/my-
205
205
  */
206
206
  import type { Express, Request, Response } from 'express';
207
207
 
208
- // Import from ldap-rest (if installed as npm package)
209
- // import DmPlugin, { asyncHandler } from 'ldap-rest/plugin';
210
-
211
- // Or use relative path to node_modules
212
- import DmPlugin from './node_modules/ldap-rest/dist/abstract/plugin.js';
213
- import type { DM } from './node_modules/ldap-rest/dist/bin/index.js';
214
- import type { Hooks } from './node_modules/ldap-rest/dist/hooks.js';
215
- // Import asyncHandler for error handling
216
- import { asyncHandler } from './node_modules/ldap-rest/dist/lib/utils.js';
208
+ // Import from ldap-rest
209
+ import DmPlugin, { asyncHandler } from 'ldap-rest/plugin';
210
+ import type { DM } from 'ldap-rest';
211
+ import type { Hooks } from 'ldap-rest/hooks';
217
212
 
218
213
  export default class ExternalAuditPlugin extends DmPlugin {
219
214
  name = 'externalAudit';
@@ -0,0 +1,18 @@
1
+ # Core hooks
2
+
3
+ Set here the documentation of all hooks.
4
+
5
+ Typescript definitions into [hooks.ts](./src/hooks.ts)
6
+
7
+ ## Demo hooks
8
+
9
+ - **hello**: called by [helloworld demo plugin](./src/plugins/helloworld.ts)
10
+
11
+ ## [LDAP](./src/lib/ldapActions.ts) hooks
12
+
13
+ - **ldapopts**: called before any ldapsearch to modify search options
14
+ - **ldapsearchresult**: called after any ldapsearch to modify search result
15
+ - **ldapaddrequest**: called before any ldapadd
16
+ - **ldapmodifyrequest**: called before any ldapmodify
17
+ - **ldapdeleterequest**: called before any ldapdelete
18
+ - **ldaprenamerequest**: called before any ldap rename/modifyDN operation
@@ -0,0 +1,89 @@
1
+ # Usage - Getting Started
2
+
3
+ Getting started and usage guide for LDAP-Rest.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install ldap-rest
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ### Minimal Configuration
14
+
15
+ ```bash
16
+ ldap-rest \
17
+ --plugin core/ldap/flatGeneric \
18
+ --ldap-url ldap://localhost:389 \
19
+ --ldap-dn "cn=admin,dc=example,dc=com" \
20
+ --ldap-pwd "password" \
21
+ --ldap-base "dc=example,dc=com" \
22
+ --ldap-flat-schema ./schemas/standard/users.json
23
+ ```
24
+
25
+ ### With Authentication
26
+
27
+ ```bash
28
+ ldap-rest \
29
+ --plugin core/auth/token \
30
+ --plugin core/ldap/flatGeneric \
31
+ --auth-token "secret-token" \
32
+ --ldap-flat-schema ./schemas/standard/users.json \
33
+ ...
34
+ ```
35
+
36
+ ### Complete Configuration
37
+
38
+ ```bash
39
+ ldap-rest \
40
+ --plugin core/auth/token \
41
+ --plugin core/ldap/flatGeneric \
42
+ --plugin core/ldap/groups \
43
+ --plugin core/ldap/organization \
44
+ --plugin core/ldap/bulkImport \
45
+ --plugin core/ldap/externalUsersInGroups \
46
+ --plugin core/static \
47
+ --plugin core/weblogs \
48
+ --ldap-flat-schema ./schemas/standard/users.json \
49
+ --bulk-import-schemas "users:./schemas/standard/users.json" \
50
+ --auth-token "admin-token" \
51
+ --static-path ./static \
52
+ ...
53
+ ```
54
+
55
+ ## LDAP Connection
56
+
57
+ ### Single URL
58
+
59
+ ```bash
60
+ --ldap-url ldap://localhost:389
61
+ ```
62
+
63
+ ### Failover (High Availability)
64
+
65
+ ```bash
66
+ --ldap-url ldap://ldap1.example.com,ldap://ldap2.example.com,ldap://ldap3.example.com
67
+ ```
68
+
69
+ The system will:
70
+
71
+ 1. Try each URL in order
72
+ 2. Use the first successful connection
73
+ 3. Automatically failover on connection failure
74
+
75
+ ## Log Levels
76
+
77
+ ```bash
78
+ --log-level error # Errors only
79
+ --log-level warn # Warnings and errors
80
+ --log-level notice # Web access logs (recommended for production)
81
+ --log-level info # General information
82
+ --log-level debug # Everything, including debug output
83
+ ```
84
+
85
+ ## Next Steps
86
+
87
+ - **[Configuration](configuration.md)** - CLI options and environment variables
88
+ - **[Plugins](plugins/README.md)** - Choose and configure plugins
89
+ - **[Troubleshooting](troubleshooting.md)** - Problem resolution