OpenLDAP client bindings for Node.js. A good start, but not, as of this writing, production quality. The API is mostly stable at this point.
This is back in active development again. Expect much churn for the next couple of weeks (or until this notice goes away).
This module works, but is not yet ready for production. It is being made available at this early stage to funnel contributors who may otherwise begin their own module in parallel. Any and all patches and pull requests are certainly welcome.
Tested with Node >= v0.4.0
To build, ensure the OpenLDAP client libraries are installed, and
npm install https://github.com/jeremycx/node-LDAP/tarball/master -g
var LDAP = require("LDAP");
var cnx = new LDAP.Connection();
// Open a connection.
cnx.open("ldap://ldap1.example.com",
function() {
cnx.search("o=company", "(uid=alice)","*",function(err, res) {
console.log(res[0].uid[0]);
});
});
var LDAP = require("LDAP");
var cnx = new LDAP.Connection();
// Open a connection.
cnx.open("ldap://ldap1.example.com",
function() {
cnx.authenticate("cn=alice,o=company", "seCretStuff", function(err, res) {
// authenticated. Try a search.
cnx.search("o=company", "(uid=bob)", "*", function(res) {
console.log("Bob has a cn of "+res[0].cn[0]);
});
});
});
The tests directory can be skimmed for more usage examples.
- all disconnect and error handling is still a little flaky.