ldap-rest 0.0.1 → 0.1.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 (62) hide show
  1. package/README.md +38 -0
  2. package/bin/sync-app-accounts.mjs +276 -0
  3. package/dist/abstract/ldapFlat.js +1 -1
  4. package/dist/abstract/plugin.js +1 -1
  5. package/dist/bin/index.js +1 -1
  6. package/dist/config/args.js +1 -1
  7. package/dist/lib/ldapActions.js +1 -1
  8. package/dist/lib/utils.js +1 -1
  9. package/dist/logger/winston.js +1 -1
  10. package/dist/plugins/auth/hmac.js +1 -0
  11. package/dist/plugins/auth/totp.js +1 -0
  12. package/dist/plugins/demo/helloworld.js +1 -1
  13. package/dist/plugins/ldap/groups.js +1 -1
  14. package/dist/plugins/ldap/onChange.js +1 -1
  15. package/dist/plugins/static.js +1 -1
  16. package/dist/plugins/twake/appAccountsApi.js +1 -0
  17. package/dist/plugins/twake/appAccountsConsistency.js +1 -0
  18. package/dist/plugins/twake/james.js +1 -1
  19. package/dist/plugins/weblogs.js +1 -1
  20. package/dist/src/abstract/ldapFlat.d.ts +0 -5
  21. package/dist/src/abstract/plugin.d.ts +1 -0
  22. package/dist/src/bin/index.d.ts +1 -0
  23. package/dist/src/browser/shared/index.d.ts +1 -0
  24. package/dist/src/browser/shared/utils/hmac.d.ts +73 -0
  25. package/dist/src/browser/shared/utils/totp.d.ts +64 -0
  26. package/dist/src/config/args.d.ts +9 -1
  27. package/dist/src/hooks.d.ts +2 -2
  28. package/dist/src/lib/ldapActions.d.ts +3 -7
  29. package/dist/src/lib/utils.d.ts +17 -0
  30. package/dist/src/logger/winston.d.ts +5 -0
  31. package/dist/src/plugins/auth/hmac.d.ts +24 -0
  32. package/dist/src/plugins/auth/totp.d.ts +35 -0
  33. package/dist/src/plugins/ldap/onChange.d.ts +1 -0
  34. package/dist/src/plugins/static.d.ts +4 -0
  35. package/dist/src/plugins/twake/appAccountsApi.d.ts +52 -0
  36. package/dist/src/plugins/twake/appAccountsConsistency.d.ts +58 -0
  37. package/docs/DEVELOPER_GUIDE.md +1 -0
  38. package/docs/PLUGIN_DEPENDENCIES.md +19 -0
  39. package/docs/README.md +74 -30
  40. package/docs/authentication.md +600 -12
  41. package/docs/plugins/DEVELOPMENT.md +148 -76
  42. package/docs/testing-with-embedded-ldap.md +342 -0
  43. package/docs/twakeAppAccountsApi.md +485 -0
  44. package/docs/weblogs.md +36 -8
  45. package/examples/web/README.md +166 -0
  46. package/examples/web/ldap-tree-viewer.html +16 -2
  47. package/examples/web/totp-client.html +543 -0
  48. package/package.json +46 -1
  49. package/static/browser/shared/index.js +1 -0
  50. package/static/browser/shared/index.js.map +1 -1
  51. package/static/browser/shared/utils/hmac.js +202 -0
  52. package/static/browser/shared/utils/hmac.js.map +1 -0
  53. package/static/browser/shared/utils/totp.js +182 -0
  54. package/static/browser/shared/utils/totp.js.map +1 -0
  55. package/static/browser/shared.esm.js +181 -1
  56. package/static/browser/shared.esm.js.map +1 -1
  57. package/static/browser/shared.js +184 -0
  58. package/static/browser/shared.js.map +1 -1
  59. package/static/browser/shared.min.js +1 -1
  60. package/static/browser/shared.min.js.map +1 -1
  61. package/static/schemas/obm/organizations.json +24 -0
  62. package/static/schemas/obm/users.json +192 -0
@@ -0,0 +1,166 @@
1
+ # Browser Examples
2
+
3
+ This directory contains interactive HTML examples demonstrating the use of LDAP-Rest browser libraries.
4
+
5
+ ## Available Examples
6
+
7
+ ### 🔐 TOTP Client (`totp-client.html`)
8
+
9
+ Interactive demonstration of the TOTP authentication client library.
10
+
11
+ **Features:**
12
+ - Real-time TOTP code generation
13
+ - Countdown timer with visual indicator
14
+ - Copy to clipboard functionality
15
+ - API client testing
16
+ - Configuration options (digits, time step)
17
+ - Code examples for npm usage
18
+
19
+ **Usage:**
20
+ ```bash
21
+ # Start the LDAP-Rest server
22
+ npm start
23
+
24
+ # Open in browser
25
+ http://localhost:8081/static/examples/web/totp-client.html
26
+ ```
27
+
28
+ **NPM Module:**
29
+ ```typescript
30
+ import {
31
+ generateTotp,
32
+ TotpAuthClient,
33
+ getRemainingSeconds,
34
+ isValidBase32
35
+ } from 'ldap-rest/browser-shared-utils-totp';
36
+ ```
37
+
38
+ ### 📁 LDAP Tree Viewer (`ldap-tree-viewer.html`)
39
+
40
+ Visualize and navigate LDAP directory structure.
41
+
42
+ **Features:**
43
+ - Interactive tree navigation
44
+ - Node details display
45
+ - Expand/collapse controls
46
+ - Refresh functionality
47
+
48
+ ### 👥 LDAP User Editor (`ldap-user-editor.html`)
49
+
50
+ Browse and edit LDAP user entries.
51
+
52
+ **Features:**
53
+ - User list and tree view
54
+ - Edit user properties
55
+ - Move users between branches
56
+ - Add/delete users
57
+
58
+ ### 👔 LDAP Group Editor (`ldap-group-editor.html`)
59
+
60
+ Manage LDAP groups and memberships.
61
+
62
+ **Features:**
63
+ - Group tree navigation
64
+ - Edit group properties
65
+ - Manage members
66
+ - Create/move/delete groups
67
+
68
+ ### 🏢 LDAP Unit Editor (`ldap-unit-editor.html`)
69
+
70
+ Manage organizational units.
71
+
72
+ **Features:**
73
+ - Unit tree structure
74
+ - Edit unit properties
75
+ - Move units
76
+ - Create/delete units
77
+
78
+ ## Running Examples
79
+
80
+ 1. **Start the server:**
81
+ ```bash
82
+ npm start
83
+ # or
84
+ npm run dev
85
+ ```
86
+
87
+ 2. **Configure authentication:**
88
+
89
+ For TOTP example:
90
+ ```bash
91
+ npm start -- \
92
+ --plugin core/auth/totp \
93
+ --auth-totp "JBSWY3DPEHPK3PXP:admin:6"
94
+ ```
95
+
96
+ 3. **Open examples in browser:**
97
+ ```
98
+ http://localhost:8081/static/examples/web/totp-client.html
99
+ http://localhost:8081/static/examples/web/ldap-tree-viewer.html
100
+ http://localhost:8081/static/examples/web/ldap-user-editor.html
101
+ http://localhost:8081/static/examples/web/ldap-group-editor.html
102
+ http://localhost:8081/static/examples/web/ldap-unit-editor.html
103
+ ```
104
+
105
+ ## Using Browser Libraries in Your Application
106
+
107
+ All browser libraries are available as npm module exports:
108
+
109
+ ```typescript
110
+ // TOTP Client
111
+ import { TotpAuthClient } from 'ldap-rest/browser-shared-utils-totp';
112
+
113
+ // Shared utilities
114
+ import { escapeHtml, createElement } from 'ldap-rest/browser-shared-utils-dom';
115
+ import { Modal } from 'ldap-rest/browser-shared-components-modal';
116
+ import { showStatus } from 'ldap-rest/browser-shared-components-statusmessage';
117
+
118
+ // LDAP Tree Viewer
119
+ import { LdapTreeViewer } from 'ldap-rest/browser-ldap-tree-viewer-ldaptreeviewer';
120
+
121
+ // User Editor
122
+ import { LdapUserEditor } from 'ldap-rest/browser-ldap-user-editor-ldapusereditor';
123
+
124
+ // Group Editor
125
+ import { LdapGroupEditor } from 'ldap-rest/browser-ldap-group-editor-ldapgroupeditor';
126
+ ```
127
+
128
+ See [package.json exports](../../package.json) for complete list of available modules.
129
+
130
+ ## Development
131
+
132
+ ### Building Examples
133
+
134
+ Examples are automatically built when you run:
135
+
136
+ ```bash
137
+ npm run build
138
+ # or
139
+ npm run build:browser
140
+ ```
141
+
142
+ ### Modifying Examples
143
+
144
+ 1. Edit the source in `src/browser/`
145
+ 2. Rebuild: `npm run build:browser`
146
+ 3. Refresh browser to see changes
147
+
148
+ ### Live Development
149
+
150
+ Use watch mode for automatic rebuilds:
151
+
152
+ ```bash
153
+ npm run build:watch
154
+ ```
155
+
156
+ ## Documentation
157
+
158
+ - [Authentication Guide](../../docs/authentication.md) - TOTP, Token, SSO authentication
159
+ - [Developer Guide](../../docs/DEVELOPER_GUIDE.md) - Building applications with LDAP-Rest
160
+ - [Browser API Documentation](../../docs/) - Detailed API documentation
161
+
162
+ ## License
163
+
164
+ Copyright 2025-present [LINAGORA](https://linagora.com)
165
+
166
+ Licensed under [GNU AGPL-3.0](../../LICENSE)
@@ -141,13 +141,12 @@
141
141
  id="search-input"
142
142
  placeholder="Search by name, uid, email..."
143
143
  style="flex: 1; padding: 8px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px;"
144
- onkeypress="if(event.key === 'Enter') document.getElementById('search-btn').click()"
145
144
  />
146
145
  <button
147
146
  id="search-btn"
148
147
  class="demo-button"
149
148
  style="margin: 0;"
150
- onclick="performSearch('${parentDn}', document.getElementById('search-input').value)"
149
+ data-parent-dn="${escapeHtml(parentDn)}"
151
150
  >
152
151
  Search
153
152
  </button>
@@ -156,6 +155,21 @@
156
155
  </div>
157
156
  </div>
158
157
  `;
158
+
159
+ // Attach event listeners for search functionality (avoid inline handlers for security)
160
+ const searchBtn = document.getElementById('search-btn');
161
+ const searchInput = document.getElementById('search-input');
162
+ if (searchBtn && searchInput) {
163
+ searchBtn.addEventListener('click', () => {
164
+ const dn = searchBtn.getAttribute('data-parent-dn');
165
+ performSearch(dn, searchInput.value);
166
+ });
167
+ searchInput.addEventListener('keypress', (e) => {
168
+ if (e.key === 'Enter') {
169
+ searchBtn.click();
170
+ }
171
+ });
172
+ }
159
173
  return;
160
174
  }
161
175