繁体   English   中英

如何使用SSL连接LDAP

[英]How to connect LDAP using SSL

我正在尝试连接到LDAP以验证用户身份。 这是我的代码,但是我无法使用我的C#代码设置SSL。

using LdapConnection = Novell.Directory.Ldap.LdapConnection;
using LdapException = Novell.Directory.Ldap.LdapException;

 var ldapHost = WebConfigurationManager.AppSettings["LDAP_HOST"];
 var ldapPort = WebConfigurationManager.AppSettings["LDAP_PORT"];

 connection.Connect(ldapHost, Convert.ToInt32(ldapPort));
 sb = new StringBuilder();
 sb.Append(ldapLocation).Append(userName).Append(",").Append(ldapLocationIndia);
 connection.Bind(LdapConnection.Ldap_V3, sb.ToString(), password);

我从应用程序安全团队收到一条消息,我正在发送普通密码,因此,我尝试通过将选项设置为

connection.SessionOptions.SecureSocketLayer = true;

但是我在连接对象中没有看到任何Sessionoption,我正在对我的LDAP操作使用novel.ldap dll。

有人可以帮我吗? 如何以安全方式通过网络为ldap服务器发送密码以进行身份​​验证。

我正在使用端口636。

提前致谢

略读API,我认为这只是

connection.SecureSocketLayer = true;

在调用Connect之前没有SessionOptions情况。

如果您只想保护Bind ,则可以先调用connection.startTLS()然后stopTLS()调用stopTLS()来做到这一点(请参见下载中的Samples \\ StartTLS.cs),但是听起来好像您要使用完整的ldaps端口636。

暂无
暂无

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

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