LDAP Client and Server API for node.js
Go to file
Mark Cavage 73f913b2c4 Search filter transformer based on schema 2011-08-22 10:48:45 -07:00
docs nicer 'spartan'-based restdown docs 2011-08-18 21:50:12 -07:00
lib Search filter transformer based on schema 2011-08-22 10:48:45 -07:00
tst Schema support for add/mofify 2011-08-19 15:08:45 -07:00
.gitignore Documentation and makefile 2011-08-15 10:53:57 -07:00
LICENSE Initial working client/server version 2011-08-04 13:32:01 -07:00
Makefile nicer 'spartan'-based restdown docs 2011-08-18 21:50:12 -07:00
README.md modifyDN touchups 2011-08-15 13:50:15 -07:00
package.json Documentation and makefile 2011-08-15 10:53:57 -07:00

README.md

ldapjs makes the LDAP protocol a first class citizen in node.js.

Usage

For full docs, head on over to http://ldapjs.org.

var ldap = require('ldapjs');

var server = ldap.createServer();

server.bind('cn=root', function(req, res, next) {
  if (req.credentials !== 'secret')
    return next(new ldap.InvalidCredentialsError());

  res.end();
});

server.search('dc=example', function(req, res, next) {
  var obj = {
    dn: req.dn.toString(),
attributes: {
  objectclass: 'helloworld',
  cn: 'hello',
  sn: 'world'
}
  };

  if (req.filter.matches(obj))
    res.send(obj);

  res.end();
});

server.listen(1389, function() {
  console.log('ldapjs listening at ' + server.url);
});

To run that, assuming you've got the OpenLDAP client on your system:

$ ldapsearch -H ldap://localhost:1389 -x -D cn=root -w secret -b dc=example objectclass=*

Installation

For now this is not published to npm. Use at your own risk.

License

MIT.

Bugs

See https://github.com/mcavage/node-ldapjs/issues.