如何在apache中使用基于表单的LDAP身份验证

如何在apache中使用基于表单的LDAP身份验证,apache,openldap,Apache,Openldap,您能告诉我如何在LDAP身份验证中使用表单而不是apache提供的默认登录弹出窗口吗 下面是apache配置,当我访问一个网页时,我会得到登录页面,但在给出用户名、密码后,我不会被重定向到请求的页面,而是会再次出现登录页面(我已经检查了在默认页面中工作的ldap凭据,它可以工作,因此ldap没有问题) #SetHandler表单登录处理程序 AuthName示例 AuthFormProvider ldap AuthType表单 AuthFormLoginRequiredLocationhttp

您能告诉我如何在LDAP身份验证中使用表单而不是apache提供的默认登录弹出窗口吗

下面是apache配置,当我访问一个网页时,我会得到登录页面,但在给出用户名、密码后,我不会被重定向到请求的页面,而是会再次出现登录页面(我已经检查了在默认页面中工作的ldap凭据,它可以工作,因此ldap没有问题)


#SetHandler表单登录处理程序
AuthName示例
AuthFormProvider ldap
AuthType表单
AuthFormLoginRequiredLocationhttp://localhost/login.html
AuthBasicProvider ldap
AuthLDAPURLldap://localhost/dc=linuxbabe,dc=com?uid?sub?(objectClass=*)
#需要ldap筛选器objectClass=posixAccount
需要有效用户
命令允许,拒绝
通融
要求所有授权
SetHandler表单登录处理程序
AuthType表单
AuthName示例
AuthFormProvider ldap
AuthFormLoginRequiredLocationhttp://localhost/login.html
测试登录
用户名:
密码:
的文档一开始就说:

表单身份验证取决于mod_会话模块


因此,您必须选择并配置其中一个模块。

感谢michael的回复,现在我的登录页面可以使用ldap进行身份验证,但在身份验证之后,我只能使用Login.html页面中的输入“httpd_location”(httpd_location))重定向,是否有任何方法重定向到用户请求的url?抱歉,我不知道怎么做。特别是,这需要重定向到用户输入中提供的URL。在生成重定向位置URL时,您可能不希望信任该输入。
<Location />
   # SetHandler form-login-handler
    AuthName example
    AuthFormProvider ldap
    AuthType form
    AuthFormLoginRequiredLocation http://localhost/login.html
    AuthBasicProvider ldap
    AuthLDAPURL ldap://localhost/dc=linuxbabe,dc=com?uid?sub?(objectClass=*)
   # Require ldap-filter objectClass=posixAccount
    Require valid-user
</Location>


   <Location "/login.html">
        Order allow,Deny
        Allow from all
        require all granted
    </Location>



    <Location /dologin.html>
      SetHandler form-login-handler
      AuthType form
      AuthName example
      AuthFormProvider ldap
      AuthFormLoginRequiredLocation http://localhost/login.html
    </Location>


<html>
<head><title>Test Login</title></head>
<body>

<form method="POST"  action="/dologin.html">
    Username: <input type="text" name="httpd_username" value="" />
    Password: <input type="password" name="httpd_password" value="" />
    <input type="submit" name="login" value="Login" />
    <input type="hidden" name="httpd_location"
value="http://localhost/index.html" />
</form>

</body>
</html>