我有一个基于网络的工具.在登录表单上,密码将在发送之前进行哈希处理.没关系,数据库只存储散列密码.
I have a web-based-tool. On the login-form, the password will hashed before sending it. All fine, the database stores only hashed passwords.
现在,我们希望通过 DirectoryEntry
使用 LDAP 登录.但是构造函数只接受普通密码.
Now, we want a login with LDAP over DirectoryEntry
.
But the constructor only accepts plain passwords.
我的问题:如何将散列密码传递给 DirectoryEntry
-class?
My question: How can I pass hashed passwords to DirectoryEntry
-class?
当前方法:
public bool isAuthenticated(string domain, string username, string pwd)
{
string domainAndUsername = domain + @"" + username;
DirectoryEntry entry = new DirectoryEntry(_path, domainAndUsername, pwd);
try
{
Object obj = entry.NativeObject;
return true;
}
catch
{
return false;
}
}
我不懂 C#,但就 LDAP 协议而言,没有办法使用已经散列的密码进行身份验证.
I do not know C#, but as far as LDAP protocol goes, there is no way to authenticate with an already hashed password.
为什么在传输之前需要对密码进行哈希处理?
Why do you need to hash the password before transmitting it?
如果要避免通过网络传输,最简单的解决方案是通过 SSL 连接到 LDAP 目录.
If it is to avoid transmitting it over the network, the easiest solution to use would be to connect to the LDAP directory over SSL.
作为旁注,IMO,传输散列密码不如明文安全:
As a side note, IMO, transmitting the hashed password is less secure than the clear one :
编辑:附加信息
Edit : Additionnal information
我不知道你使用的是哪个 LDAP 目录,但是在 OpenLDAP 上,如果你不使用绑定操作,你可以实现这种机制(例如,你将无法使用密码策略覆盖).
I don't know which LDAP directory you use, but on OpenLDAP, you could implement this kind of mechanism if you don't use the bind operation (for example, you won't be able to use the password policy overlay).
您可以实现 SASL 代理授权 到:
它将允许您仍然从 ACL 机制和日志系统中受益于执行的用户操作
It will allows you to still benefit from the ACL mechanism and logging system for users operations performed
但是:这将仅在 OpenLDAP 上可用(或者如果另一个 LDAP 实现提供相同的机制)并且它并不是 LDAP 协议的最先进技术;)
BUT: This will be available only on OpenLDAP (or if another LDAP implemenation offer the same mechanism) and it is not really the most state of the art about the LDAP protocol ;)
这篇关于使用 LDAP 验证之前的哈希密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!