Search code examples
node.jsauthenticationactive-directoryldapntlm

LDAP authentication failing


I have a nodejs application that successfully authenticates using LDAP locally using passport-ldapauth.

However, in another environment it is not working. I have written a .net app that can successfully query LDAP. The different is that it uses NTLM.

I am not familiar with NTLM and how this affects my nodejs project.

LDAP_URL = ldap://<ldap_server_ip address>
LDAP_BIND_DN = ldapadmin
LDAP_BIND_CREDENTIALS = password123
LDAP_SEARCH_BASE = DC=mydomain,DC=com
LDAP_SEARCH_FILTER = (sAMAccountName={{username}})

Am I talking apples and oranges here? I get invalid credentials even though they work in my .net app.

nodesjs code:

super(
  (
    request: Request,
    callback
  ) => {
    const options = {
      server: {
        url: getEnvValue('LDAP_URL'),
        bindDN: getEnvValue('LDAP_BIND_DN'),
        bindCredentials: getEnvValue('LDAP_BIND_CREDENTIALS'),
        searchBase: getEnvValue('LDAP_SEARCH_BASE'),
        searchFilter: getEnvValue('LDAP_SEARCH_FILTER'),
      },
      passReqToCallback: true,
    };
    callback(null, options);
  }
);

Any thoughts would greatly appreciated.

Gina


Solution

  • After many many hours, the answer was simpler than expected:

    LDAP_BIND_DN = mydomain\ldapadmin
    

    Gina