Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
code format
  • Loading branch information
lytsing committed Aug 10, 2017
1 parent 60e533c commit 0779328
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -3,7 +3,7 @@
AD, LDAP 的认证, 从mantis 的LDAP code 扩展剪裁。在win2003+active directory 测试过。原地址: http://www.zentao.net/extension-viewext-25.html


*注:现在添加的认证只是基于ldap密码验证,需要在禅道系统里面有对应的用户名,否则登陆不成功。*
*注:现在添加的认证只是基于 LDAP 密码验证,需要在禅道系统里面有对应的用户名,否则登陆不成功。*

## 安装文档

Expand Down
17 changes: 9 additions & 8 deletions module/user/ext/config/ldap.php
@@ -1,4 +1,5 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */

/**
* Specifies the LDAP or Active Directory server to connect to, and must be
Expand All @@ -16,21 +17,21 @@
* ldaps://ldap.example.com:3269/
*
*/
$config->ldap->ldap_server = 'ldap://ldap.example.com:389/';
$config->ldap->ldap_server = 'ldap://ldap.example.com:389/';
/**
* The LDAP Protocol Version, if 0, then the protocol version is not set. For Active Directory use version 3.
*/
$config->ldap->ldap_protocol_version = 3;
$config->ldap->ldap_protocol_version = 3;
/**
* Determines whether the LDAP library automatically follows referrals returned by LDAP servers or not.
* This maps to LDAP_OPT_REFERRALS ldap library option. For Active Directory, this should be set to OFF.
*/
$config->ldap->ldap_follow_referrals = 0; //1 ON, 0 OFF
$config->ldap->ldap_root_dn = 'ou=www,dc=abc,dc=com';
$config->ldap->ldap_uid_field = 'sAMAccountName'; // Use 'sAMAccountName' for Active Directory
$config->ldap->ldap_bind_dn = 'CN=admin,OU=admin,DC=abc,DC=com';
$config->ldap->ldap_bind_passwd = 'abcdef';
$config->ldap->ldap_follow_referrals = 0; //1 ON, 0 OFF
$config->ldap->ldap_root_dn = 'ou=www,dc=abc,dc=com';
$config->ldap->ldap_uid_field = 'sAMAccountName'; // Use 'sAMAccountName' for Active Directory
$config->ldap->ldap_bind_dn = 'CN=admin,OU=admin,DC=abc,DC=com';
$config->ldap->ldap_bind_passwd = 'abcdef';
/**
* Search filter for acitve person only, !(userAccountControl:1.2.840.113556.1.4.803:=2) means active user in AD
*/
#$config->ldap->ldap_organization = '(objectCategory=person)(!(userAccountControl:1.2.840.113556.1.4.803:=2))';
#$config->ldap->ldap_organization = '(objectCategory=person)(!(userAccountControl:1.2.840.113556.1.4.803:=2))';
2 changes: 1 addition & 1 deletion module/user/ext/model/ldap.php
Expand Up @@ -2,7 +2,7 @@

function identify($account, $password)
{
if(!$account or !$password) return false;
if (!$account or !$password) return false;

/* admin account skip LDAP Authenticate */
if ($account == "admin") {
Expand Down

0 comments on commit 0779328

Please sign in to comment.