【问题标题】:Using Apache LDAP Authentification on index.php/admin在 index.php/admin 上使用 Apache LDAP 身份验证
【发布时间】:2013-10-21 10:36:07
【问题描述】:

我正在尝试寻找一种解决方案,为我的 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>

【问题讨论】:

    标签: php linux apache ldap limesurvey


    【解决方案1】:

    一个可能的解决方案是通过编辑使 LimeSurvey 在 URL 中没有 index.php /application/config/config.php 和设置

    'showScriptName' => false,
    

    这样 URL 看起来更像

    http://yourdomain/limesurvey/admin/authentication/sa/login 
    

    LDAP 可能会起作用。

    【讨论】:

      【解决方案2】:

      为什么不将 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 的保护

      【讨论】:

      • 祝你好运,请随时留言!
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-04
      • 1970-01-01
      相关资源
      最近更新 更多