npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cappern/node-red-ldap

v0.1.4

Published

Another ldap node for node-red

Downloads

37

Readme

@cappern/node-red-ldap

Another LDAP node for Node-RED built on top of ldapts. It provides:

  • A config node cappern-ldap-config to define server connection (host, port, protocol, TLS options, base DN, and credentials)
  • A runtime node cappern-ldap to perform LDAP searches with optional message-based overrides

Install

From your Node-RED user directory (usually ~/.node-red):

npm install @cappern/node-red-ldap

Restart Node-RED and look for the nodes under the Function category.

Nodes

  • cappern-ldap-config: Shared connection configuration

    • host: Server hostname or IP
    • port: Defaults to 389 for ldap and 636 for ldaps
    • protocol: ldap or ldaps
    • base: Default Base DN
    • Ignore TLS errors: When ldaps, disables certificate verification (insecure)
    • CA Certificates (PEM): Optional trusted CA bundle for ldaps
    • credentials: Bind DN and Password (optional)
  • cappern-ldap: Perform LDAP search

    • Default Base DN, Filter, Scope (base|one|sub), Attributes (comma separated)
    • Outputs: msg.payload as an array of entry objects
    • Errors: attaches msg.error = { name, code, message } and sets node status

Message Overrides

The cappern-ldap node accepts the following fields from the incoming message to override the node/config:

  • msg.base: Base DN
  • msg.filter: LDAP filter (defaults to (objectClass=*))
  • msg.scope: base, one, or sub (defaults to sub)
  • msg.attributes: comma-separated string or array of attribute names
  • msg.bindDN: Bind DN for this invocation
  • msg.bindCredentials: Bind password for this invocation

When attributes is empty, the server default attribute set is returned.

Examples

Find a user by uid under the node’s Base DN:

{
  "filter": "(uid=alice)"
}

Return specific attributes only under a specific OU:

{
  "base": "ou=people,dc=example,dc=com",
  "filter": "(objectClass=person)",
  "attributes": ["cn", "mail", "sn"]
}

Search one level below an OU:

{
  "base": "ou=people,dc=example,dc=com",
  "filter": "(cn=Alice*)",
  "scope": "one"
}

Bind as end-user for this search only:

{
  "bindDN": "uid=alice,ou=people,dc=example,dc=com",
  "bindCredentials": "user-password",
  "base": "dc=example,dc=com",
  "filter": "(uid=alice)"
}

Error Handling

On error, the node sets a red status with a concise message (e.g. invalid credentials, base DN not found, timeout, connection error) and attaches details to msg.error:

{
  "error": { "name": "InvalidCredentialsError", "code": 49, "message": "Invalid credentials" }
}

You can branch on msg.error using a Switch node.

Development & Tests

This repo includes a Mocha test suite using the official Node-RED node test helper. The LDAP client is mocked so tests do not require a live directory server.

  • Test runner: Mocha + Chai
  • Helper: node-red-node-test-helper with embedded Node-RED runtime
  • Location: test/ldap.spec.js

Install dev dependencies and run tests:

npm install
npm test

What’s covered:

  • Node loads with the config node
  • Successful search emits entries to msg.payload
  • Missing base DN reports an error on output
  • Invalid credentials are mapped to a friendly status and error payload

Optional Live LDAPS Test

There is an opt-in integration test that connects to a real LDAPS server. It is skipped by default and only runs when LDAP_LIVE=1 is set and connection details are provided.

Env vars:

  • LDAP_LIVE=1 — enable the live test
  • LDAP_URL=ldaps://host:636 — or provide LDAP_HOST, LDAP_PORT, LDAP_PROTOCOL
  • LDAP_BASE=dc=example,dc=com — base DN to search
  • LDAP_BIND_DN and LDAP_BIND_PW — optional bind credentials
  • LDAP_FILTER — optional search filter (defaults to (objectClass=*))
  • LDAP_TLS_INSECURE=1 — optional, disable TLS verification (insecure)
  • LDAP_CA_PATH=/path/to/ca.pem or LDAP_CA_PEM="...PEM..." — optional CA bundle

Run just the live test:

LDAP_LIVE=1 LDAP_URL=ldaps://ldap.example.com:636 LDAP_BASE=dc=example,dc=com \
LDAP_BIND_DN="cn=admin,dc=example,dc=com" LDAP_BIND_PW="secret" \
npm test -- --grep "live ldaps"

License

AGPL-3.0-or-later (see LICENSE)