Skip to content

Latest commit

 

History

History
70 lines (50 loc) · 1.88 KB

README.md

File metadata and controls

70 lines (50 loc) · 1.88 KB

node-ldap

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.

Current Notes

This is back in active development again. Expect much churn for the next couple of weeks (or until this notice goes away).

Contributing

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.

Dependencies

Tested with Node >= v0.4.0

Installation

To build, ensure the OpenLDAP client libraries are installed, and

npm install https://github.com/jeremycx/node-LDAP/tarball/master -g

Search Example

    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]);
         });
    });

Authenticate Example

    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.

TODO:

  • all disconnect and error handling is still a little flaky.