node-ldapjs icon indicating copy to clipboard operation
node-ldapjs copied to clipboard

Problem binding to active directory special characters

Open ips219 opened this issue 1 year ago • 1 comments

Hello...

I've an strange issue when binding to an Active Directory Server. I am trying to authenticate the user using ldapjs. This is my code which works fine with most users... ` var connectionSettings = { url: LDAP_URL, bindDN: "domain\ipindado", bindCredentials: LDAP_ADMIN_PASSWORD };

      const client = ldap.createClient({ url: [connectionSettings .url]  });

    client.bind(connectionSettings.bindDN, connectionSettings.bindCredentials, (err: Error | null) => {
      if (err) {
        console.error('Error...:', err);
      } else {
        console.log('Sucess...');
      }
    });

` Note that I am making the simple binding using "domain\samaccountname" instead of DistinguisedName

But I have some issues with some specific users, when the DistinguisedName conmtains special characters like áéíóú as for example

"dn": "CN=Jos\c3\a9 Ignacio Gonzalez,OU=Externos_O365,OU=BU,DC=domain,DC=local",

The strange thing is that I'm not using the DN for binding, I am using samaccountname with domain "domain\jigonzalez" which works fine for most of the users.

And we have also testested removing the special characters in the Active Directory and authentication works fine for these users after removing the characters.

Did any body faced something similar?

Thanks and Best regards.

ips219 avatar May 07 '24 08:05 ips219

When bind failed, for some users, can you check the server event log?

WanpengQian avatar May 14 '24 01:05 WanpengQian