我正在尝试找到有关为我的LimeSurvey 2.0安装设置第一阶段LDAP身份验证的解决方案。现在我面临着一个问题,我可以指定应该受到保护的目录,但 LimeSurvey 使用 index.php/admin 作为管理界面。是否有可能从我的 vhost.conf 中为这个确切的文件 + "/admin" 指定下面的代码?或者你知道一个更好的解决方案。如果有人能帮助我,那就太好了。
已经非常感谢了!
<Directory />
AuthLDAPUrl ldap://ldap.mydomain.com
/ou=users,[...]
AuthLDAPBindDN [...]
AuthLDAPBindPassword [...]
AuthBasicProvider ldap
AuthType Basic
AuthName [...]
Require valid-user
[...]
Satisfy any
</Directory>
一个可能的解决方案是通过编辑使LimeSurvey在URL中没有索引.php/application/config/config.php和设置
'showScriptName' => false,
这样 URL 将更像
http://yourdomain/limesurvey/admin/authentication/sa/login
和 LDAP 可能有效。
为什么不将 apache 基本身份验证与 PHP LDAP 系统结合起来呢?
<?php
// Check username and password:
if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])){
//store user
$Username = $_SERVER['PHP_AUTH_USER'];
//store password
$Password = $_SERVER['PHP_AUTH_PW'];
//Here the LDAP auth should be in place. $ldap is the ldap connection protocol object
if ($ldap->doAuth($Username,$Password)) {
//perform XML data output, based on $ldap->userinformation
} else {
// The text inside the realm section will be visible for the
// user in the login box
header('WWW-Authenticate: Basic realm="Mobile Feed"');
header('HTTP/1.0 401 Unauthorized');
echo '<?xml version="1.0" encoding="UTF-8"?>
<x protocolversion="1" lang="nl">
<x code="1">fail</fout>
</x>
';
}
}
?>
并将其与以下库相结合:http://code.google.com/p/ldap-auth-php/
上面的库有一个名为 protectsinglepage.php 的包含。您可以将其包含在主项目中。对于管理系统,只需将其排除在外,这样它就不会受到LDAP的保护