1

I'm using Linq to LDAP, and was wondering if there's a way to authenticate against the AD using Linq to LDAP,

Maybe something to the effect of this

var user = context.Query<User>().FirstOrDefault(u => u.SAMAccountName == "user123" && u.Password == "1234");
MichaC
  • 13,104
  • 2
  • 44
  • 56
Null Reference
  • 11,260
  • 40
  • 107
  • 184

1 Answers1

1

Passwords cannot be returned by a search in AD. You are only allowed to modify them over SSL. You can try to issue a Bind request using an LdapConnection, but that doesn't require LINQ to LDAP, only 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?

Alan
  • 456
  • 2
  • 9