UNPKG

1.06 kBMarkdownView Raw
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
8LDAPjs makes the LDAP protocol a first class citizen in Node.js.
9
10## Usage
11
12For full docs, head on over to <http://ldapjs.org>.
13
14```javascript
15var ldap = require('ldapjs');
16
17var server = ldap.createServer();
18
19server.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
34server.listen(1389, function() {
35 console.log('ldapjs listening at ' + server.url);
36});
37```
38
39To run that, assuming you've got the [OpenLDAP](http://www.openldap.org/)
40client 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
50MIT.
51
52## Bugs
53
54See <https://github.com/mcavage/node-ldapjs/issues>.