Zend:ApacheDS和Windows ldap身份验证问题

时间:2013-10-11 06:56:05

标签: php zend-framework ldap apacheds

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

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

我的开发环境是:

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

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

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结构如下所示。

enter image description here

我的窗户轻量级AD服务如下所示。

enter image description here

1 个答案:

答案 0 :(得分:0)

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

  1. 使用ApacheDS服务器: 您的项目正在使用对象类查询用户条目:posixAccount(查看错误消息中提到的查询:(&(objectClass = posixAccount)(uid = mshakeel1))
  2. 为了解决这个问题,你需要一个具有给定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“不正确。