ldap-rest 0.0.1 → 0.1.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 (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 +28 -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 +76 -30
  40. package/docs/authentication.md +604 -12
  41. package/docs/plugins/DEVELOPMENT.md +162 -76
  42. package/docs/testing-with-embedded-ldap.md +347 -0
  43. package/docs/twakeAppAccountsApi.md +485 -0
  44. package/docs/weblogs.md +37 -8
  45. package/examples/web/README.md +175 -0
  46. package/examples/web/ldap-tree-viewer.html +16 -2
  47. package/examples/web/totp-client.html +541 -0
  48. package/package.json +132 -87
  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,175 @@
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
+
13
+ - Real-time TOTP code generation
14
+ - Countdown timer with visual indicator
15
+ - Copy to clipboard functionality
16
+ - API client testing
17
+ - Configuration options (digits, time step)
18
+ - Code examples for npm usage
19
+
20
+ **Usage:**
21
+
22
+ ```bash
23
+ # Start the LDAP-Rest server
24
+ npm start
25
+
26
+ # Open in browser
27
+ http://localhost:8081/static/examples/web/totp-client.html
28
+ ```
29
+
30
+ **NPM Module:**
31
+
32
+ ```typescript
33
+ import {
34
+ generateTotp,
35
+ TotpAuthClient,
36
+ getRemainingSeconds,
37
+ isValidBase32,
38
+ } from 'ldap-rest/browser-shared-utils-totp';
39
+ ```
40
+
41
+ ### 📁 LDAP Tree Viewer (`ldap-tree-viewer.html`)
42
+
43
+ Visualize and navigate LDAP directory structure.
44
+
45
+ **Features:**
46
+
47
+ - Interactive tree navigation
48
+ - Node details display
49
+ - Expand/collapse controls
50
+ - Refresh functionality
51
+
52
+ ### 👥 LDAP User Editor (`ldap-user-editor.html`)
53
+
54
+ Browse and edit LDAP user entries.
55
+
56
+ **Features:**
57
+
58
+ - User list and tree view
59
+ - Edit user properties
60
+ - Move users between branches
61
+ - Add/delete users
62
+
63
+ ### 👔 LDAP Group Editor (`ldap-group-editor.html`)
64
+
65
+ Manage LDAP groups and memberships.
66
+
67
+ **Features:**
68
+
69
+ - Group tree navigation
70
+ - Edit group properties
71
+ - Manage members
72
+ - Create/move/delete groups
73
+
74
+ ### 🏢 LDAP Unit Editor (`ldap-unit-editor.html`)
75
+
76
+ Manage organizational units.
77
+
78
+ **Features:**
79
+
80
+ - Unit tree structure
81
+ - Edit unit properties
82
+ - Move units
83
+ - Create/delete units
84
+
85
+ ## Running Examples
86
+
87
+ 1. **Start the server:**
88
+
89
+ ```bash
90
+ npm start
91
+ # or
92
+ npm run dev
93
+ ```
94
+
95
+ 2. **Configure authentication:**
96
+
97
+ For TOTP example:
98
+
99
+ ```bash
100
+ npm start -- \
101
+ --plugin core/auth/totp \
102
+ --auth-totp "JBSWY3DPEHPK3PXP:admin:6"
103
+ ```
104
+
105
+ 3. **Open examples in browser:**
106
+ ```
107
+ http://localhost:8081/static/examples/web/totp-client.html
108
+ http://localhost:8081/static/examples/web/ldap-tree-viewer.html
109
+ http://localhost:8081/static/examples/web/ldap-user-editor.html
110
+ http://localhost:8081/static/examples/web/ldap-group-editor.html
111
+ http://localhost:8081/static/examples/web/ldap-unit-editor.html
112
+ ```
113
+
114
+ ## Using Browser Libraries in Your Application
115
+
116
+ All browser libraries are available as npm module exports:
117
+
118
+ ```typescript
119
+ // TOTP Client
120
+ import { TotpAuthClient } from 'ldap-rest/browser-shared-utils-totp';
121
+
122
+ // Shared utilities
123
+ import { escapeHtml, createElement } from 'ldap-rest/browser-shared-utils-dom';
124
+ import { Modal } from 'ldap-rest/browser-shared-components-modal';
125
+ import { showStatus } from 'ldap-rest/browser-shared-components-statusmessage';
126
+
127
+ // LDAP Tree Viewer
128
+ import { LdapTreeViewer } from 'ldap-rest/browser-ldap-tree-viewer-ldaptreeviewer';
129
+
130
+ // User Editor
131
+ import { LdapUserEditor } from 'ldap-rest/browser-ldap-user-editor-ldapusereditor';
132
+
133
+ // Group Editor
134
+ import { LdapGroupEditor } from 'ldap-rest/browser-ldap-group-editor-ldapgroupeditor';
135
+ ```
136
+
137
+ See [package.json exports](../../package.json) for complete list of available modules.
138
+
139
+ ## Development
140
+
141
+ ### Building Examples
142
+
143
+ Examples are automatically built when you run:
144
+
145
+ ```bash
146
+ npm run build
147
+ # or
148
+ npm run build:browser
149
+ ```
150
+
151
+ ### Modifying Examples
152
+
153
+ 1. Edit the source in `src/browser/`
154
+ 2. Rebuild: `npm run build:browser`
155
+ 3. Refresh browser to see changes
156
+
157
+ ### Live Development
158
+
159
+ Use watch mode for automatic rebuilds:
160
+
161
+ ```bash
162
+ npm run build:watch
163
+ ```
164
+
165
+ ## Documentation
166
+
167
+ - [Authentication Guide](../../docs/authentication.md) - TOTP, Token, SSO authentication
168
+ - [Developer Guide](../../docs/DEVELOPER_GUIDE.md) - Building applications with LDAP-Rest
169
+ - [Browser API Documentation](../../docs/) - Detailed API documentation
170
+
171
+ ## License
172
+
173
+ Copyright 2025-present [LINAGORA](https://linagora.com)
174
+
175
+ 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