簡體   English   中英

與ZEND auth ldap連接的另一種方法

[英]another way to connect with ZEND auth ldap

我想連接到ldap服務器。 我通過在application.ini中使用以下代碼來完成此操作

ldap.server.host = ldaps://ldap.example.ro
ldap.server.username = "uid=admin,ou=people,dc=example,dc=ro"
ldap.server.password = "password"
ldap.server.baseDn = "ou=people,dc=example,dc=ro"
ldap.server.bindRequiresDn = true

接着

    $auth = Zend_Auth::getInstance();

    $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini',
                                'production');
    $options = $config->ldap->toArray();

    $adapter = new Zend_Auth_Adapter_Ldap($options, $username, $password);

    $result = $auth->authenticate($adapter);

沒有管理員和密碼,有什么辦法可以做同樣的事情? 沒有ldap.server.username和ldap.server.password

我找到了一個方法。 很簡單...

在application.ini中

 ldap.server.host = ldaps://ldap.example.ro
 ldap.server.baseDn = "ou=people,dc=example,dc=ro"

唯一的區別是$ username必須是

 $username = "uid=". $username . ",ou=people,dc=example,dc=ro"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM