$tlCfg->authentication['method'] = 'LDAP';
$tlCfg->authentication['ldap_server'] = 'xxx.xxx.xxx.xxx';
$tlCfg->authentication['ldap_port'] = '389';
$tlCfg->authentication['ldap_version'] = '3'; // could be '2' in some cases
$tlCfg->authentication['ldap_root_dn'] = 'ou=People,dc=1v,dc=cn';
$tlCfg->authentication['ldap_bind_dn'] = ''; // Left empty for anonymous LDAP binding
$tlCfg->authentication['ldap_bind_passwd'] = ''; // Left empty for anonymous LDAP binding
$tlCfg->authentication['ldap_tls'] = false; // true -> use tls
$tlCfg->authentication['ldap_organization'] = ''; // e.g. '(organizationname=*Traffic)'
$tlCfg->authentication['ldap_uid_field'] = 'uid'; // Use 'sAMAccountName' for Active Directory
//一定要设置为true,否则每个ldap用户第一次登陆时需要注册
$tlCfg->authentication['ldap_automatic_user_creation'] = true;
// Configure following fields in custom_config.inc.php according your configuration
$tlCfg->authentication['ldap_email_field'] = 'mail';
$tlCfg->authentication['ldap_firstname_field'] = 'givenname';
$tlCfg->authentication['ldap_surname_field'] = 'sn';
/** Enable/disable Users to create accounts on login page */
$tlCfg->user_self_signup = TRUE;