【发布时间】:2014-08-12 11:15:56
【问题描述】:
我正在审查通过创建DirectoryEntry 对象来针对 LDAP 服务器验证用户凭据的代码,如下所示
DirectoryEntry entry = new DirectoryEntry(_path, domainAndUsername, pwd);
try
{
object obj = entry.NativeObject;
}
catch (Exception ex)
{
throw new Exception("Error authenticating user. " + ex.Message);
}
如果未引发异常,则代码假定用户凭据正常..
代码运行良好,但我的问题与它的安全性有关。使用了 SSL,所以客户端和 web 服务器之间的通信是安全的,但是 webserver 和 ldap 服务器之间的通信是否存在漏洞?
DirectoryEntry 构造函数还有另一个重载参数,称为AuthenticationType。因为在上面的代码中没有指定参数,所以它使用AuthenticationType = None,这相当于基本身份验证。
使用AuthenticationType = Secure 或AuthenticationType = SecureSocketsLayer 或AuthenticationType = Encryption 或者它们的按位组合会更好吗?
迈克尔
【问题讨论】:
标签: .net authentication active-directory ldap directoryentry