Difference between #3 and #4 of
How to use ldap in UserIdentity for authentication

Revision #4 has been created by jonah on Jan 26, 2010, 6:06:16 PM with the memo:

fixed highlighting
« previous (#3) next (#5) »

Changes

Title unchanged

How to use ldap in UserIdentity for authentication

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

Content changed

It took me a while to get ldap auth working with yii, so I write it down here, maybe it can be of some use. Yii does not have a ldap class by itself, but you can extend it for example with Zend classes. To authenticate users at you page via ldap, change protected/components/UserIdentity.php in the following way: On top of the file add:
 
    
 
```php 
Yii::import('application.vendors.*'); require_once('Zend/Ldap.php');  
```
Delete or comment out everything in the authenticate() function. Then add
 
    
 
```php 
$options = array(
'host' => 'your.ldap.host.com',
'username' => 'your_admin_users_username',
[...]
$this->errorCode=self::ERROR_NONE;
}
return !$this->errorCode;
 
```
For this to work you need Exception.php, Ldap.php and the Ldap folder from the library folder of a Zend installation in the folder protected/vendors/Zend
11 0
18 followers
Viewed: 90 335 times
Version: 1.1
Category: Tutorials
Written by: BeerSerc
Last updated by: Navarr
Created on: Jan 26, 2010
Last updated: 10 years ago
Update Article

Revisions

View all history