node-ldapjs/README.md

55 lines
1.1 KiB
Markdown
Raw Normal View History

2014-07-06 16:55:33 +00:00
# LDAPjs
2019-09-15 13:25:06 +00:00
[![Build Status](https://github.com/ldapjs/node-ldapjs/workflows/.github/workflows/main.yml/badge.svg)]
2019-09-15 13:31:18 +00:00
[![Coverage Status](https://coveralls.io/repos/github/ldapjs/node-ldapjs/badge.svg)]
2014-07-06 16:55:33 +00:00
LDAPjs makes the LDAP protocol a first class citizen in Node.js.
2011-08-15 20:50:15 +00:00
## Usage
For full docs, head on over to <http://ldapjs.org>.
2014-07-06 16:55:33 +00:00
```javascript
var ldap = require('ldapjs');
2011-08-15 20:50:15 +00:00
2014-07-06 16:55:33 +00:00
var server = ldap.createServer();
2011-08-15 20:50:15 +00:00
2014-07-06 16:55:33 +00:00
server.search('dc=example', function(req, res, next) {
var obj = {
dn: req.dn.toString(),
attributes: {
objectclass: ['organization', 'top'],
o: 'example'
}
};
2011-08-15 20:50:15 +00:00
2014-07-06 16:55:33 +00:00
if (req.filter.matches(obj.attributes))
res.send(obj);
2011-08-15 20:50:15 +00:00
2014-07-06 16:55:33 +00:00
res.end();
});
2011-08-15 20:50:15 +00:00
2014-07-06 16:55:33 +00:00
server.listen(1389, function() {
console.log('ldapjs listening at ' + server.url);
});
```
2011-08-15 20:50:15 +00:00
To run that, assuming you've got the [OpenLDAP](http://www.openldap.org/)
client on your system:
2011-08-15 20:50:15 +00:00
2011-08-25 04:46:31 +00:00
ldapsearch -H ldap://localhost:1389 -x -b dc=example objectclass=*
2011-08-04 20:32:01 +00:00
## Installation
2011-08-25 04:46:31 +00:00
npm install ldapjs
2014-07-06 16:55:33 +00:00
2019-08-27 21:22:26 +00:00
DTrace support is included in ldapjs. To enable it, `npm install dtrace-provider`.
2011-08-04 20:32:01 +00:00
## License
MIT.
## Bugs
See <https://github.com/ldapjs/node-ldapjs/issues>.