2013-10-11 151 views
0

我正在嘗試將ldap身份驗證集成到我的一個Zend項目中。Zend:ApacheDS和Windows ldap身份驗證問題

我嘗試使用ApacheDS和Windows ldap for windows 7.我可以連接到兩個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))" 
    } 
} 

我的application.ini是ApacheDS中如下:

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" 
    } 

我的application.ini是爲Windows如下LDAP:

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

回答

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" 是不正確
+0

非常感謝您的回答,我想替代品您所提供 另外請你請你告訴我,我怎麼可以設置以下參數: ldap.server.accountDomainName&ldap.server.accountDomainNameShort 謝謝 – Shakeel