Skip to content

Passing options to LdapAuth directly from config@^3.0.0 may fail #82

Description

@jketreno

I'm just documenting this problem/solution here in case others encounter it.

I hadn't updated my system in a while; on updating several packages, ldapauth's authenticate started returning that it couldn't find the LDAP user, even though the user was findable using ldapsearch, or with a backup copy of node_modules I had.

After bisecting all the packages that had upgraded, I root caused the failure to a commit in npm-config which changes config objects to be immutable (commit 1fe27bf30 on npm-config)

I had been initializing ldapauth-fork via:

const config = require("config"),
  LdapAuth = require("ldapauth-fork");
const ldap = new LdapAuth(config.get("ldap"));

which previously worked fine. And seems like it should work--there are no warnings or errors printed. However, you can't authenticate anymore with the LDAP client.

The fix was to give LdapAuth a copy of the object returned from config:

const ldap = new LdapAuth(Object.assign({}, config.get("ldap")));

Cheers,
James

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions