Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jketreno opened this issue Feb 18, 2020 · 0 comments
Open

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

jketreno opened this issue Feb 18, 2020 · 0 comments

Comments

@jketreno
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant