views:

221

answers:

1

I am working with zend framework, PHP , Ldap on Ubuntu. I am authenticating users from ldap using zend library. Now I want to change user's ldap passwords using zend. Any Idea?

This is the method that I am using to get zend authentication adapter. It is working perfectly and users are authenticated using this adapter.

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

Now how to change ldap passwords? Thanks

+1  A: 

Hi Naveed,

Use Zend_Auth_Adapter_Ldap for authenticating logins and such with an active directory.

For admin purposes of ldap, use Zend_Ldap.

Read the Zend documentation on the Zend_Ldap API, specifically the following

Zend_Ldap save(string|Zend_Ldap_Dn $dn, array $entry)

Saves the entry identified by $dn with its attributes $entry to the LDAP tree. Throws a Zend_Ldap_Exception if the entry could not be saved. This method decides by querying the LDAP tree if the entry will be added or updated.

Tjorriemorrie