2014-07-06 16:55:33 +00:00
|
|
|
# LDAPjs
|
2013-10-25 11:59:39 +00:00
|
|
|
|
2020-11-13 04:34:41 +00:00
|
|
|
[![Build Status](https://github.com/ldapjs/node-ldapjs/workflows/Lint%20And%20Test/badge.svg)](https://github.com/ldapjs/node-ldapjs/actions)
|
|
|
|
[![Coverage Status](https://coveralls.io/repos/github/ldapjs/node-ldapjs/badge.svg)](https://coveralls.io/github/ldapjs/node-ldapjs/)
|
2013-10-25 07:32:50 +00:00
|
|
|
|
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
|
|
|
|
2015-06-15 01:51:14 +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
|
|
|
|
2023-03-08 22:19:36 +00:00
|
|
|
## Node.js Version Support
|
|
|
|
|
|
|
|
As of `ldapjs@3` we only support the active Node.js LTS releases.
|
|
|
|
See [https://github.com/nodejs/release#release-schedule][schedule] for the LTS
|
|
|
|
release schedule.
|
|
|
|
|
|
|
|
For a definitive list of Node.js version we support, see the version matrix
|
|
|
|
we test against in our [CI configuration][ci-config].
|
|
|
|
|
|
|
|
Note: given the release date of `ldapjs@3`, and the short window of time that
|
|
|
|
Node.js v14 had remaining on its LTS window, we opted to not support Node.js
|
|
|
|
v14 with `ldapjs@3` (we released late February 2023 and v14 goes into
|
|
|
|
maintenance in late April 2023). Also, Node.js v14 will be end-of-life (EOL) on
|
|
|
|
September 11, 2023; this is a very shortened EOL timeline and makes it even
|
|
|
|
more reasonable to not support it at this point.
|
|
|
|
|
|
|
|
[schedule]: https://github.com/nodejs/release#release-schedule
|
|
|
|
[ci-config]: https://github.com/ldapjs/node-ldapjs/blob/master/.github/workflows/main.yml
|
|
|
|
|
2011-08-04 20:32:01 +00:00
|
|
|
## License
|
|
|
|
|
|
|
|
MIT.
|
|
|
|
|
|
|
|
## Bugs
|
|
|
|
|
2019-08-27 19:28:07 +00:00
|
|
|
See <https://github.com/ldapjs/node-ldapjs/issues>.
|