promised-ldap
This library is a quick-n-dirty shim over ldapjs to add promises and easier authentication. It currently only supports the client interface.
Usage
To create a new client:
var LdapClient = ;var client = url: 'ldap://127.0.0.1:389';
The options argument to the constructor is identical to the options argument used in ldapjs
for
ldap.createClient
. Please see the docs here.
It supports the other methods documented there as well, except that instead of taking a callback, the methods return a promise. E.g.:
client;
The search
method in ldapjs
is now accessible (in promisified form) by client._search
. I
have provided a method client.search
with similar behaviour as the original but an arguably
easier API. E.g.:
client;
Let's face it, the reason why you're messing about with LDAP is probably to add LDAP authentication to your app, so I've added a couple of helper method for this:
client;
This basically does a bind
using the supplied credentials, and if successful, does a search
for
the specified user and returns that.
If all you really wanted was the user's name, email address, and list of unqualified groups, we can do that too:
client;
Pull requests and suggestions are welcome!