簡體   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