LDAP Client and Server API for node.js
Go to file
Mark Cavage d33e7cc26a Docs and anonymous bind support 2011-08-24 12:38:23 -07:00
docs Docs and anonymous bind support 2011-08-24 12:38:23 -07:00
lib Docs and anonymous bind support 2011-08-24 12:38:23 -07:00
tst docs, and minor enhancements to compare/search apis 2011-08-22 17:16:36 -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 Docs and anonymous bind support 2011-08-24 12:38:23 -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.