dev-master
9999999-devLdap
MIT
The Requires
- php >=5.6
- yiisoft/yii2 *
- ext-ldap *
The Development Requires
by Christopher Mota
extension yii2 ldap active directory openldap
Wallogit.com
2017 © Pedro Peláez
Ldap
This extension provides the LDAP integration for the Yii framework 2.0. It includes basic querying/search support and also implements the ActiveRecord pattern that allows you to store active records in Active Directory or OpenLDAP., (*1)
To use yii2-ldap, your sever must support:, (*3)
PHP LDAP Extension, (*4)
The preferred way to install this extension is through composer., (*5)
Either run, (*6)
php composer.phar require --prefer-dist chrmorandi/yii2-ldap
or add, (*7)
"chrmorandi/yii2-ldap": "*"
to the require section of your composer.json., (*8)
return [
//....
'components' => [
'ldap' => [
'class' => 'chrmorandi\ldap\Connection',
// Mandatory Configuration Options
'dc' => [
'192.168.1.1',
'ad.com'
],
'baseDn' => 'dc=ad,dc=com',
'username' => 'administrator@ad.com',
'password' => 'password',
// Optional Configuration Options
'port' => 389,
'followReferrals' => false,
'useTLS' => true,
// Change pageSize (e.g. to 1000) if you are getting the following message
// with large result sets:
// ldap_search(): Partial search results returned: Sizelimit exceeded
'pageSize' => -1,
],
]
];
To authenticate users using your AD server, call the Yii::$app->ldap->auth()
method on your provider:, (*9)
try {
if (Yii::$app->ldap->auth($this->username, $password)) {
// Credentials were correct.
} else {
// Credentials were incorrect.
}
} catch (Exception $e) {
// error
}
}
Ldap
MIT
extension yii2 ldap active directory openldap