【问题标题】:PHP LDAP connection authenticates without DN informationPHP LDAP 连接在没有 DN 信息的情况下进行身份验证
【发布时间】:2013-06-25 20:12:31
【问题描述】:

这是我第一次使用 PHP 5 LDAP 库,我有点困惑。如果有人能就以下问题给我一些澄清,我将非常高兴:

首先让我给出我的配置:

LDAP 服务器: Windows Server 2013 Active Directory

主机名: winad

域: domain.local

IP: 1.1.1.1(为了解释)

用于绑定的 Windows 帐户:管理员

从开发机器 Ping 主机名可以正常工作

从开发机器Ping ip

从开发机器 Ping winad.domain.local 失败

开发环境:带有 WAMP 的 Windows 8 Professional

PHP: 5.3.13

PHP LDAP 模块已加载并正常工作

Apache LDAP 模块未加载

场景:

我正在尝试使用管理员帐户针对 Windows AD 对用户进行身份验证。这是我的代码示例:

我将在以下各种场景中使用这些变量:

$hostname = "winad";
$dnex= "uid=Administrator, ou=Users, dc=domain, dc=local";

有效的代码:

$conn = ldap_connect($hostname);
$bind = ldap_bind($conn, "DOMAIN\Administrator", "password");

失败的代码:

$conn = ldap_connect($hostname);
$bind = ldap_bind($conn, $dnex, "password");

错误:凭据无效

现在我的问题是为什么当我指定一个 dn 时它会失败?

假设我有 location1.domain.local 和 location2.domain.local,我只想与 location2 绑定,如果不指定 dn 似乎是不可能的。

有人可以展示正确的方法吗?

【问题讨论】:

    标签: php binding active-directory ldap windows-server


    【解决方案1】:

    经过一番搜索,我找到了以下帖子:

    PHP LDAP Connection

    AlexC 的回答正确回答了我的问题。

    希望这有帮助。

    【讨论】:

      猜你喜欢
      • 2016-04-12
      • 1970-01-01
      • 1970-01-01
      • 2012-01-11
      • 1970-01-01
      • 2018-10-06
      • 1970-01-01
      • 2011-07-23
      • 1970-01-01
      相关资源
      最近更新 更多