1 | # LDAPjs
|
2 |
|
3 | [!['Build status'][travis_image_url]][travis_page_url]
|
4 |
|
5 | [travis_image_url]: https://api.travis-ci.org/mcavage/node-ldapjs.svg
|
6 | [travis_page_url]: https://travis-ci.org/mcavage/node-ldapjs
|
7 |
|
8 | LDAPjs makes the LDAP protocol a first class citizen in Node.js.
|
9 |
|
10 | ## Usage
|
11 |
|
12 | For full docs, head on over to <http://ldapjs.org>.
|
13 |
|
14 | ```javascript
|
15 | var ldap = require('ldapjs');
|
16 |
|
17 | var server = ldap.createServer();
|
18 |
|
19 | server.search('dc=example', function(req, res, next) {
|
20 | var obj = {
|
21 | dn: req.dn.toString(),
|
22 | attributes: {
|
23 | objectclass: ['organization', 'top'],
|
24 | o: 'example'
|
25 | }
|
26 | };
|
27 |
|
28 | if (req.filter.matches(obj.attributes))
|
29 | res.send(obj);
|
30 |
|
31 | res.end();
|
32 | });
|
33 |
|
34 | server.listen(1389, function() {
|
35 | console.log('ldapjs listening at ' + server.url);
|
36 | });
|
37 | ```
|
38 |
|
39 | To run that, assuming you've got the [OpenLDAP](http://www.openldap.org/)
|
40 | client on your system:
|
41 |
|
42 | ldapsearch -H ldap://localhost:1389 -x -b dc=example objectclass=*
|
43 |
|
44 | ## Installation
|
45 |
|
46 | npm install ldapjs
|
47 |
|
48 | ## License
|
49 |
|
50 | MIT.
|
51 |
|
52 | ## Bugs
|
53 |
|
54 | See <https://github.com/mcavage/node-ldapjs/issues>.
|