C# netcore ldap authentication using Novell.Directory.Ldap.NETStandard library

故事扮演 提交于 2019-12-03 21:55:34

Been working on this as well and ran into the same error. I had to use the Windows domain and username to log in:

String loginDN = "DOMAIN\\jperez";
String password1 = "Jperez123";

lc.Bind(loginDN, password1);

Once I did that, I got in without issue.

I had the same issue until I used this

lc.Bind("uid=" + objUser.UserName + ",ou=SomeValue,dc=SomeValue,dc=SomeValue",password);

also I did not supply a version like in your example

It also works for me:

var ldapVersion = LdapConnection.Ldap_V3;
var loginDN = "CN=victor,CN=Users,DC=example,DC=com";
var password = "123";
conn.Bind(ldapVersion, loginDN, password);

Works on Windows Server 2012r2 with the default domain settings. If you want to get loginDNs for your domain users, just execute next cmd command on domain controller:

dsquery user 

More information here

Yet another variation, I found I had to logon as:

"PartA PartB" of an AD username. (notice the space in the name.)

example being "App Alerts" whereas I normally can login with "AppAlerts"... but this is the Fully Qualified name i found with dsquery user:

"CN=App Alerts,OU=SBSUsers,OU=Users,OU=MyBusiness,DC=myinc,DC=local"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!