LDAP Client and Server API for node.js
Go to file
Joe Walnes 84b1926aac Fixes connection error:
-----------------
2011-07-26 17:17:17Z WARN - Client: 1.2.3.4 unexpected connection error Error: EINVAL, Invalid argument

node.js:134
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
Error: EINVAL, Invalid argument
    at doConnect (net.js:555:5)
    at Socket.connect (net.js:715:5)
    at Object.createConnection (net.js:265:5)
    at newConnection (/usr/local/lib/node/.npm/ldapjs/0.1.0/package/lib/client.js:145:15)
    at new Client (/usr/local/lib/node/.npm/ldapjs/0.1.0/package/lib/client.js:222:27)
    at Object.createClient (/usr/local/lib/node/.npm/ldapjs/0.1.0/package/lib/index.js:48:12)
    at Object.<anonymous> (/home/jwalnes/dev/ldap/auth.js:7:19)
    at Module._compile (module.js:402:26)
    at Object..js (module.js:408:10)
    at Module.load (module.js:334:31)
2011-08-26 15:35:01 -05:00
docs typo in docs 2011-08-25 12:19:17 -07:00
lib Fixes connection error: 2011-08-26 15:35:01 -05:00
tst [GH-3] Unit Test 2011-08-26 08:29:57 -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 minor doc/readme update 2011-08-24 21:46:31 -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.search('dc=example', function(req, res, next) {
  var obj = {
    dn: req.dn.toString(),
attributes: {
  objectclass: ['organization', 'top'],
  o: 'example'
}
  };

  if (req.filter.matches(obj.attributes))
    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 -b dc=example objectclass=*

Installation

npm install ldapjs

License

MIT.

Bugs

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