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.3.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
136K
increased by4.46%
Maintainers
1
Weekly downloads
 
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 29 Sep 2016

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