Zend framework 如何使用zend更改ldap密码

Zend framework 如何使用zend更改ldap密码,zend-framework,ldap,Zend Framework,Ldap,我正在Ubuntu上使用zend framework、PHP和Ldap。我正在使用zend库对ldap中的用户进行身份验证。现在我想使用zend更改用户的ldap密码。有什么想法吗 这是我用来获取zend身份验证适配器的方法。它工作正常,用户使用该适配器进行身份验证 public function getAuthAdapter(array $params) { $front = Zend_Controller_Front::getInstance(); $opt

我正在Ubuntu上使用zend framework、PHP和Ldap。我正在使用zend库对ldap中的用户进行身份验证。现在我想使用zend更改用户的ldap密码。有什么想法吗

这是我用来获取zend身份验证适配器的方法。它工作正常,用户使用该适配器进行身份验证

public function getAuthAdapter(array $params)
{
        $front = Zend_Controller_Front::getInstance();

        $options = $front->getParam('bootstrap')->getOption('ldap');
        $params['username'] = split( "@" , $params['username'] );           
        $username = 'cn=' . $params['username'][0] . ',' . $options['server1']['baseDn'];                       
        $adapter = new Zend_Auth_Adapter_Ldap( $options, $username, $params['password']);

        $adapter->setIdentity( $params['username'] );
        $adapter->setCredential( $params['password'] );

        return $adapter;
} 

现在如何更改ldap密码?感谢您使用Zend_Auth_Adapter_Ldap对active directory登录等进行身份验证

出于ldap的管理目的,请使用Zend_ldap

阅读Zend_Ldap API上的Zend文档,特别是以下内容

Zend_Ldap存储字符串| Zend_Ldap_Dn$Dn,数组$entry

将由$dn标识的条目保存为 它的属性是LDAP的$entry 树如果发生以下情况,则引发Zend_Ldap_异常 无法保存该条目。这 方法通过查询LDAP来决定 如果要添加条目或 更新


使用Zend_Auth_Adapter_Ldap对active directory的登录等进行身份验证

出于ldap的管理目的,请使用Zend_ldap

阅读Zend_Ldap API上的Zend文档,特别是以下内容

Zend_Ldap存储字符串| Zend_Ldap_Dn$Dn,数组$entry

将由$dn标识的条目保存为 它的属性是LDAP的$entry 树如果发生以下情况,则引发Zend_Ldap_异常 无法保存该条目。这 方法通过查询LDAP来决定 如果要添加条目或 更新

这就是我的工作方式!请注意,在发送之前我没有加密密码,但服务器以正确的加密方式存储了密码

这就是我的工作方式!请注意,在发送之前我没有加密密码,但服务器以正确的加密方式存储了密码

$ldap=new Zend_Ldap($options);
    $ldap->bind();      
    $entry=$ldap->getEntry($user->dn);
    $entry['userpassword'][0]=$newpassword;
    $ldap->save($user->dn, $entry);