
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
ldapjs-client
Advanced tools
node >= 8.0
No ldapjs
(https://www.npmjs.com/package/ldapjs) as dependency.
Why: because ldapjs
is not maintained for more than two years.
npm install ldapjs-client
To create a new client:
var LdapClient = require('ldapjs-client');
var client = new LdapClient({ url: 'ldap://127.0.0.1:389' });
Attribute | Type | Description |
---|---|---|
url | String | A valid LDAP URL (proto/host/port only) |
timeout | Number | Milliseconds client should let operations live for before timing out (Default: Infinity) |
tlsOptions | Object | Additional options passed to TLS connection layer when connecting via ldaps:// (See: The TLS docs for node.js) |
try {
const entry = {
cn: 'foo',
sn: 'bar',
email: ['foo@bar.com', 'foo1@bar.com'],
objectclass: 'fooPerson'
};
await client.add('cn=foo, o=example', entry);
} catch (e) {
console.log('Add failed');
}
try {
await client.bind('username', 'password');
} catch (e) {
console.log('Bind failed');
}
try {
await client.del('cn=foo, o=example');
} catch (e) {
console.log(e);
}
try {
const change = {
operation: 'add', // add, delete, replace
modification: {
pets: ['cat', 'dog']
}
};
await client.modify('cn=foo, o=example', change);
} catch (e) {
console.log(e);
}
try {
await client.modifyDN('cn=foo, o=example', 'cn=bar');
} catch (e) {
console.log(e);
}
try {
const options = {
filter: '(&(l=Seattle)(email=*@foo.com))',
scope: 'sub',
attributes: ['dn', 'sn', 'cn']
};
const entries = await client.search('o=example', options);
} catch (e) {
console.log(e);
}
Attribute | Type | Description |
---|---|---|
scope | String | One of base, one, or sub. Defaults to base |
filter | String | A string version of an LDAP filter. Defaults to (objectclass=*) |
attributes | Array of String | attributes to select and return. Defaults to the empty set, which means all attributes |
sizeLimit | Number | the maximum number of entries to return. Defaults to 0 (unlimited) |
timeLimit | Number | the maximum amount of time the server should take in responding, in seconds. Defaults to 10. Lots of servers will ignore this |
typesOnly | Boolean | on whether you want the server to only return the names of the attributes, and not their values. Borderline useless. Defaults to false |
try {
await client.unbind();
} catch (e) {
console.log(e);
}
try {
await client.destroy();
} catch (e) {
console.log(e);
}
Close connection if exists and destroy current client
Pull requests and suggestions are welcome!
MIT.
FAQs
LDAP js client
The npm package ldapjs-client receives a total of 1,317 weekly downloads. As such, ldapjs-client popularity was classified as popular.
We found that ldapjs-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.