简体   繁体   English

使用LinqtoLDAP验证用户

[英]Authenticate user using LinqtoLDAP

I'm using Linq to LDAP, and was wondering if there's a way to authenticate against the AD using Linq to LDAP, 我正在使用Linq to LDAP,并且想知道是否存在使用Linq to LDAP对AD进行身份验证的方法,

Maybe something to the effect of this 也许对这个有影响

var user = context.Query<User>().FirstOrDefault(u => u.SAMAccountName == "user123" && u.Password == "1234");

Passwords cannot be returned by a search in AD. 在AD中搜索无法返回密码。 You are only allowed to modify them over SSL. 仅允许您通过SSL修改它们。 You can try to issue a Bind request using an LdapConnection, but that doesn't require LINQ to LDAP, only SYstem.DirectoryServices.Protocols. 您可以尝试使用LdapConnection发出绑定请求,但这不需要LINQ to LDAP,只需SYstem.DirectoryServices.Protocols。

var connection = new LdapConnection("localhost");

try
{
    connection.Bind(new NetworkCredential("username", "password", "domain"));
}
catch (LdapException ex)
{

}

Is there a reason why you can't use NTLM or Kerberos? 有没有原因不能使用NTLM或Kerberos?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM