繁体   English   中英

在index.php / admin上使用Apache LDAP身份验证

[英]Using Apache LDAP Authentification on index.php/admin

我正在尝试找到有关为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>

一种可能的解决方案是通过编辑/application/config/config.php并设置,使LimeSurvey在URL中不包含index.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保护

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM