was able to add this feature by making the following changes:
in user.class.php I eliminated the self::isPasswordMgmtExternal test in comparePassword and encryptPassword
in doAuthorize.php I changed the auth_does_password_match function
function auth_does_password_match(&$user,$cleartext_password)
{
$authCfg = config_get('authentication');
$ret = new stdClass();
$ret->status_ok = true;
$ret->msg = 'ok';
if ('LDAP' == $authCfg['method'])
{
$msg[ERROR_LDAP_AUTH_FAILED] = lang_get('error_ldap_auth_failed');
$msg[ERROR_LDAP_SERVER_CONNECT_FAILED] = lang_get('error_ldap_server_connect_failed');
$msg[ERROR_LDAP_UPDATE_FAILED] = lang_get('error_ldap_update_failed');
$msg[ERROR_LDAP_USER_NOT_FOUND] = lang_get('error_ldap_user_not_found');
$msg[ERROR_LDAP_BIND_FAILED] = lang_get('error_ldap_bind_failed');
$xx = ldap_authenticate($user->login, $cleartext_password);
// if the LDAP fails for any reason then check the local
if($xx->status_ok)
{
// LDAP authenticated
$ret->status_ok = $xx->status_ok;
$ret->msg = $msg[$xx->status_code];
}
else
{
//LDAP failed - try the local DB
if ($user->comparePassword($cleartext_password) != tl::OK)
{
// LDAP pass back the original LDAP error if the local db does not authenticate
$ret->status_ok = $xx->status_ok;
$ret->msg = $msg[$xx->status_code];
}
}
}
else // normal database password compare
{
if ($user->comparePassword($cleartext_password) != tl::OK)
$ret->status_ok = false;
}
return $ret;
}
//////////////////////////////////////////////////////
In our environment we use LDAP for our general users and we create special administrative users using local ids. I have noticed a few requests for this in the forums.
I have updated the code below to support checking only when the LDAP user is not found.
function auth_does_password_match(&$user,$cleartext_password)
{
$authCfg = config_get('authentication');
$ret = new stdClass();
$ret->status_ok = true;
$ret->msg = 'ok';
if ('LDAP' == $authCfg['method'])
{
$msg[ERROR_LDAP_AUTH_FAILED] = lang_get('error_ldap_auth_failed');
$msg[ERROR_LDAP_SERVER_CONNECT_FAILED] = lang_get('error_ldap_server_connect_failed');
$msg[ERROR_LDAP_UPDATE_FAILED] = lang_get('error_ldap_update_failed');
$msg[ERROR_LDAP_USER_NOT_FOUND] = lang_get('error_ldap_user_not_found');
$msg[ERROR_LDAP_BIND_FAILED] = lang_get('error_ldap_bind_failed');
$xx = ldap_authenticate($user->login, $cleartext_password);
// if the LDAP fails for any reason then check the local
if($xx->status_ok)
{
// LDAP authenticated
$ret->status_ok = $xx->status_ok;
$ret->msg = $msg[$xx->status_code];
}
else
{
// user not found in LDAP - try the local DB
if($xx->status_code == ERROR_LDAP_USER_NOT_FOUND)
{
if ($user->comparePassword($cleartext_password) != tl::OK)
{
// LDAP pass back the original LDAP error if the local db does not authenticate
$ret->status_ok = $xx->status_ok;
$ret->msg = $msg[$xx->status_code];
}
}
else
{
// LDAP pass back the original LDAP error if the local db does not authenticate
$ret->status_ok = $xx->status_ok;
$ret->msg = $msg[$xx->status_code];
}
}
}
else // normal database password compare
{
if ($user->comparePassword($cleartext_password) != tl::OK)
$ret->status_ok = false;
}
return $ret;
}
分享到:
相关推荐
### Maximo - LDAP 配置 #### 预备知识 **LDAP协议** - **定义**: 轻量级目录访问协议(Lightweight Directory Access Protocol, LDAP)是一种基于TCP/IP的应用层协议,用于访问和管理分布式环境下的目录服务。它...
LDAP(Lightweight Directory Access Protocol)是一种轻量级目录访问协议,它源于X.500标准,但针对TCP/IP网络环境进行了简化,使得其在现代企业网络环境中得到了广泛的应用。飞塔信息技术公司的资料详尽地介绍了...
在本文中,我们将深入探讨如何在Domino 6.5.4环境下配置LDAP服务,包括启用服务、配置参数、创建目录服务数据库以及设置全局网络域。 首先,启用LDAP服务是配置的第一步。这涉及在服务器的notes.ini文件中添加LDAP...
在配置过程中遇到“db2 list tables”命令显示数据库中没有表的问题,这可能是因为数据库尚未初始化或未正确配置。针对DB2 9.5版本,你需要使用TDS6.2作为LDAP服务器来支持WebSphere Portal的数据仓库项目。 接下来...
1. 配置 LDAP 组:在 Confluence 中创建 LDAP 组,例如 admin、user 等。 2. 配置权限:在 Confluence 中配置权限,例如 admin 组具有管理员权限,user 组具有普通用户权限。 3. 配置 LDAP 用户登录:在 Confluence ...
在本配置中,我们将深入探讨如何配置LDAP与流控联动进行认证管理,以及如何在用户管理中添加AD(Active Directory)服务器。 首先,在用户管理界面,选择“认证配置”选项。在这里,你会看到“LDAP认证”设置。点击...
在进行LDAP配置的过程中,还需要将设备添加到系统中。设备添加不仅包括物理设备的接入,还包括设备的名称、型号等信息的录入,这对于后续的设备管理和维护非常关键。 #### 十二、LDAP用户数据的导入方法 LDAP用户...
这是一遍比较完整的linux下svn+apche+ldap安装配置手册,根据本人实际安装整理后的文档,目前都算是最新版本。其中ldap使用sun的opends,个人感觉比openldap要方便,当然重点不是用什么ldap而是如何配置。 主要包括...
LDAP 配置手册 LDAP(Lightweight Directory Access Protocol)是一种轻量级目录访问...* 数据导入:在飞连 v2.0 中配置 LDAP 服务器,并将数据导入到系统中。 * 认证认证:在飞连 v2.0 中使用 LDAP 进行认证认证。
在实际操作中,详细步骤可能因BIEE版本和具体的LDAP环境而有所不同。"External authentication.doc"文件应提供了具体配置过程的详细说明和图解,包括可能遇到的问题和解决方案。通过这份文档,你可以按照步骤进行...
在 Debian 系统中搭建 LDAP 服务器需要完成安装、配置和测试三个步骤。下面将详细讲解每个步骤的实现过程。 步骤1:安装LDAP 首先,需要安装 LDAP 服务器和相关工具。使用以下命令安装: ``` # apt-get install ...
1. 配置文件:在Linux系统中,OpenLDAP服务器的主要配置文件通常位于`/etc/openldap/slapd.conf`(某些系统可能使用`slapd.d`目录的子目录结构)。 2. 数据库配置:定义存储数据的后端类型,如Berkeley DB、HDB或...
OpenLDAP是一个开放源代码实现的LDAP系统,本文将详细介绍如何在Linux环境下安装配置OpenLDAP,并使用它来管理用户的账号信息。 #### 二、OpenLDAP软件概述 OpenLDAP按照客户机/服务器模型设计,由以下几个组件构成...
在LDAP目录结构中代表"组织单元"(Organizational Unit)。例如,你可以按部门来划分,如"ou=Sales,dc=example,dc=com"代表销售部。每一条目都有一个唯一的标识符,即DN(Distinguished Name),它是由一系列属性...
加密种子字符串(Encryption seed string)是设置 LDAP 服务的初始安全参数,这里设置为 `nidsldap1234`,它用于生成存储在 LDAP 目录中的密码的散列值。 接下来的步骤涉及了 LDAP 服务器的安装,包括选择安装插件...
在配置文件`slapd.conf`中,例如,你需要设定目录的后缀(如`o=linuxfocus.org`),根DN(如`cn=Manager, o=linuxfocus.org`)以及数据库的保存位置。同时,为了安全起见,你不应将rootDN的明文密码直接写入配置文件...
在本文中,我们将深入探讨Open LDAP的安装与配置过程,以及如何在Windows环境下进行操作。 **一、Open LDAP的基本概念** Open LDAP基于Berkeley DB作为其后端数据库,提供了一个标准的LDAP接口,用于查询和修改...
ldap 服务配置文档 pam 及数据库导入当操作。
在文档“ldap组件配置案例.doc”中,主要讨论了如何在CAMS系统中集成LDAP组件,以实现与外部应用系统如邮件系统或Windows域的账号共享和统一认证。下面我们将详细探讨这一配置过程及其关键知识点。 1. **功能描述**...