使用 CGI+TCL 的 LDAP 身份验证

发布于 2024-07-10 02:03:49 字数 139 浏览 6 评论 0原文

如何使用 CGI/TCL 堆栈通过 LDAP 对用户进行身份验证?

如果可能,请提供示例代码片段。


我在 RHEL 5.0 上使用 Apache Web 服务器; AD 存在于远程 Win2003 服务器上。

How can I authenticate a user with LDAP using CGI/TCL stack?

Please provide a sample code-snippet if possible.


I am using an Apache Web Server on RHEL 5.0; AD exists on a remote Win2003 server.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

赤濁 2024-07-17 02:03:50

下面是一个示例,它将连接到 ldap 服务器并检索 ldap 有关电子邮件地址的所有信息:

package require ldap
set sEmailAddress "[email protected]"

set handle [::ldap::connect example.com 3268]
ldap::bind $handle

set result [::ldap::search $handle "dc=example,dc=com" "(mail=$sEmailAddress)" {sAMAccountName}]

foreach {object attributes} $result {
  foreach {name val} $attributes {
    puts "$name\t$val"
  }
}

Here is an example that will connect to an ldap server and retrieve all of the info ldap has about an email address:

package require ldap
set sEmailAddress "[email protected]"

set handle [::ldap::connect example.com 3268]
ldap::bind $handle

set result [::ldap::search $handle "dc=example,dc=com" "(mail=$sEmailAddress)" {sAMAccountName}]

foreach {object attributes} $result {
  foreach {name val} $attributes {
    puts "$name\t$val"
  }
}
垂暮老矣 2024-07-17 02:03:50

这是 ldap 包。 您首先使用一些可以看到每个人的“绑定用户”进行绑定。 然后,您可以根据某些属性(例如电子邮件地址或 sAMAccountName<)搜索用户/a>. 如果用户存在,则使用给定的密码和用户的完整路径再次绑定。

Here's the ldap package. You first bind using some "bind user" who can see everyone. You then search for the user based on some attribute like e-mail address or sAMAccountName. If the user exists, bind again using the given password and the full path of the user.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文