An yii2 extension to authenticate and/or syncronize users against LDAP for 2amigos/yii2-usuario.
The preferred way to install this extension is through composer.
Either run:
php composer.phar require --prefer-dist yetopen/yii2-usuario-ldap "*"
or add
"yetopen/yii2-usuario-ldap": "*"
to the require section of your composer.json
file.
Add in your config (config/web.php
for the basic app):
//...
'bootstrap' => ['log', 'usuarioLdap'],
//...
'components' => [
//...
'usuarioLdap' => [
'class' => 'yetopen\usuarioLdap\Module',
'ldapConfig' => [
'hosts' => ['host.example.com'],
'base_dn' => 'dc=mydomain,dc=local',
'account_prefix' => 'cn=',
'account_suffix' => ',ou=Users,dc=mydomain,dc=local',
'use_ssl' => true,
'username' => 'bind_username',
'password' => 'bind_password',
],
'createLocalUsers' => TRUE,
'defaultRoles' => ['standardUser'],
'syncUsersToLdap' => TRUE,
'secondLdapConfig' => [
'hosts' => ['host.example.com'],
'base_dn' => 'dc=mydomain,dc=local',
'account_prefix' => 'cn=',
'account_suffix' => ',ou=Users,dc=mydomain,dc=local',
'username' => 'bind_username',
'password' => 'bind_password',
],
'allowPasswordRecovery' => FALSE,
'passwordRecoveryRedirect' => ['/controller/action']
],
//...
]
adapting parameters to your setup.
defaultUserId
is used for the sessioncreateLocalUsers
is set to FALSE must contain the ID of an user to be used as local. Defaults to -1
passwrdRecoveryRedirect
. Defaults to FALSE.allowPasswordRecovery
is set to FALSE specifies the URL where the user will be redirected when trying to recover the password. This parameter will be processed by yii\helpers\Url::to().
Comments