Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ldap-filter

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ldap-filter

API for handling LDAP-style filters

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is ldap-filter?

The ldap-filter npm package is used to construct and parse LDAP (Lightweight Directory Access Protocol) filters. It provides a simple and intuitive way to create complex LDAP queries programmatically.

What are ldap-filter's main functionalities?

Constructing LDAP Filters

This feature allows you to construct LDAP filters using various filter types such as AndFilter, EqualityFilter, and PresenceFilter. The code sample demonstrates creating a filter that matches entries with a common name of 'John Doe' and a presence of the 'mail' attribute.

const ldap = require('ldap-filter');
const filter = new ldap.AndFilter({
  filters: [
    new ldap.EqualityFilter({ attribute: 'cn', value: 'John Doe' }),
    new ldap.PresenceFilter({ attribute: 'mail' })
  ]
});
console.log(filter.toString()); // Output: (&(cn=John Doe)(mail=*))

Parsing LDAP Filters

This feature allows you to parse LDAP filter strings into filter objects. The code sample demonstrates parsing an LDAP filter string into an object representation.

const ldap = require('ldap-filter');
const filterString = '(&(cn=John Doe)(mail=*))';
const filter = ldap.parse(filterString);
console.log(filter);

Combining Filters

This feature allows you to combine multiple filters using logical operators like AND, OR, and NOT. The code sample demonstrates combining two filters using the AND operator.

const ldap = require('ldap-filter');
const filter1 = new ldap.EqualityFilter({ attribute: 'cn', value: 'John Doe' });
const filter2 = new ldap.PresenceFilter({ attribute: 'mail' });
const combinedFilter = new ldap.AndFilter({ filters: [filter1, filter2] });
console.log(combinedFilter.toString()); // Output: (&(cn=John Doe)(mail=*))

Other packages similar to ldap-filter

FAQs

Package last updated on 16 Oct 2014

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc