0

我正在尝试将 ldap 身份验证集成到我的 Zend 项目之一。

我尝试在 Windows 7 上使用 ApacheDS 和 Windows ldap。我可以连接到两个 ldap 服务器,但身份验证没有成功。

我的开发环境是:

  • Windows 7的
  • IIS 服务器
  • PHP 和 MSSQL
  • ApacheDS 或 Windows LDAP

当我使用 ApacheDS 时,我收到以下错误:

object(Zend_Auth_Result)#122 (3) {
  ["_identity":protected] => string(9) "mshakeel1"
  ["_messages":protected] => array(4) {
    [0] => string(28) "Account not found: mshakeel1"
    [1] => string(71) "0x20: No object found for: (&(objectClass=posixAccount)(uid=mshakeel1))"
    [2] => string(188) "host=localhost,accountDomainName=foo.net,accountDomainNameShort=FOO,accountCanonicalForm=3,username=uid=admin,ou=system,password=*****,baseDn=ou=users,ou=system,bindRequiresDn=1,port=10389"
    [3] => string(104) "mshakeel1 authentication failed: 0x20: No object found for: (&(objectClass=posixAccount)(uid=mshakeel1))"
  }
}

对于 ApacheDS,我的 application.ini 如下:

ldap.server.host = localhost
ldap.server.accountDomainName = foo.net
ldap.server.accountDomainNameShort = FOO
ldap.server.accountCanonicalForm = 3
ldap.server.username = "uid=admin,ou=system"
ldap.server.password = 'secret'
ldap.server.baseDn = "ou=users,ou=system"
ldap.server.bindRequiresDn = true
ldap.server.port = 10389

当我使用 Windows LDAP 时,我收到以下错误:

object(Zend_Auth_Result)#122 (3) {
  ["_code":protected] => int(-3)
  ["_identity":protected] => string(9) "mshakeel1"
  ["_messages":protected] => array(4) {
    [0] => string(19) "Invalid credentials"
    [1] => string(129) "0x31 (Invalid credentials; 8009030C: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 2030, v1db0): W\mshakeel1"
    [2] => string(139) "host=ABC-PC-SH,useStartTls=,accountDomainName=w.net,accountDomainNameShort=W,accountCanonicalForm=3,baseDn=CN=Employees,DC=ABC,DC=SHGroup"
    [3] => string(162) "mshakeel1 authentication failed: 0x31 (Invalid credentials; 8009030C: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 2030, v1db0): W\mshakeel1"
  }

对于 Windows LDAP,我的 application.ini 如下:

ldap.server.host = ABC-PC-SH
ldap.server.useStartTls = false
ldap.server.accountDomainName = w.net
ldap.server.accountDomainNameShort = W
ldap.server.accountCanonicalForm = 3
ldap.server.baseDn = "CN=Employees,DC=ABC,DC=SHGroup"

任何人都可以给我一个提示来解决这个问题吗?谢谢。

编辑:想添加更多信息。我的 ApacheDS 结构如下所示。

在此处输入图像描述

而我的windows轻量级AD服务如下图。

在此处输入图像描述

4

1 回答 1

0

以下可能是您在将项目连接到两个不同的 LDAP 服务器时提到的两个错误的原因:

  1. 使用 ApacheDS 服务器:您的项目正在使用对象类查询用户条目:posixAccount(查看错误消息中提到的查询:(&(objectClass=posixAccount)(uid=mshakeel1)))

为了解决这个问题,您需要一个具有给定 uid 的对象,该对象是使用对象类创建的:posixAccount。我不确定它是否是 ApacheDS 默认支持的对象类。如果没有,您需要将该对象类添加到 ApacheDS。您可以参考:http ://hasini-gunasinghe.blogspot.com/2011/02/how-to-introduce-custom-attributes-to.html 。

或者,您可以更改您的项目以使用 ApacheDS 中支持的对象类构建上述搜索查询。(用于创建用户对象的默认对象类是:inetOrgPerson)并确保搜索到的条目在 ApacheDS 服务器中。

  1. 对于 Active Directory,从错误消息来看,似乎为用户提供的凭据:""mshakeel1" 不正确。
于 2013-10-22T14:21:36.500 回答