Dear All,
I am new to yii frame work i am trying to create an ldap configuration for user authentication
The following steps which i taken to create but it throws eerro as below
include(Controller.php) [<a href=‘function.include’>function.include</a>]: failed to open stream: No such file or directory
C:\xampp\htdocs\yiif\framework\YiiBase.php(418)
steps:
- i have included the following http://www.yiiframework.com/extension/ldaprecord/
extension in C:\xampp\htdocs\seed2\protected\extensions\ldaprecord
- i have included the following code in config/main.php
‘components’=>array(
'user'=>array(
// enable cookie-based authentication
'allowAutoLogin'=>true,
),
'ldap'=>array(
'class' => 'ext.ldaprecord.LdapComponent',
'server' => 'ldap://192.168.x.xxxx',
'port' => 389,
//'bind_rdn' => 'cn=suren diran,cn=Users,dc=xxxx,dc=demo,dc=com',
//'bind_pwd' => 'pass@123',
'base_dn' => 'dc=rsales,dc=demo,dc=com'),);
'params'=>array(
// this is used in contact page
'adminEmail'=>'sundarapandian@rsalesarm.com',
),
'ldap'=>array(
'class' => 'ext.ldaprecord.LdapComponent',
'server' => 'ldap://192.168.x.xxx',
'port' => 389,
//'bind_rdn' => 'cn=xxxx xxxx,cn=Users,dc=xxxx,dc=demo,dc=com',
//'bind_pwd' => 'pass@123',
'base_dn' => 'dc=xxxxx,dc=demo,dc=com'),
);
- included this line in the index.php
$config=dirname(FILE).’/protected/extensions/ldaprecord/CLdapRecord.php’;
- and i have changed the useridentity authentication function as
public function authenticate()
{
$username=$this->username;
$password=$this->password;
$dname= ‘xxxxxxx’;
$options[‘host’]=‘ldap://192.168.x.xxx’;
$options[‘port’]=389;
$ldap_username = "CN=".$username.",CN=Users,DC=xxxx,DC=demo,DC=com";
$options = Yii::app()->params['ldap'];
print_r($options);
$connection = ldap_connect($options['host'], $options['port']);
//print_r($connection);
ldap_set_option($connection, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($connection, LDAP_OPT_REFERRALS, 0);
if($connection)
{
echo "success";
//exit;
try
{
//echo $connection.$ldap_username.$this->password;
//print_r(ldap_bind($connection,$dname."\\". $ldap_username, $password));
//exit;
@$bind = ldap_bind($connection,$dname."\\". $ldap_username, $password);
print_r(@$bind);
if(@$bind)
{
echo "successfully logedin";
}
}
catch (Exception $e){
echo $e->getMessage();
}
if(!$bind) $this->errorCode = self::ERROR_PASSWORD_INVALID;
else $this->errorCode = self::ERROR_NONE;
}
return !$this->errorCode;
}
i am stucked here can any one help me hw to resolve this issue .please help me ,Thanks in advance…