配置 Tomcat 以使用 Windows Active Directory 进行身份验证 [英] Configuring Tomcat to authenticate using Windows Active Directory

查看:27
本文介绍了配置 Tomcat 以使用 Windows Active Directory 进行身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

配置 Tomcat 5.5 或更高版本以对来自 Windows Active Directory 的用户进行身份验证的最佳方法是什么?

What is the best way to configure Tomcat 5.5 or later to authenticate users from Windows Active Directory?

推荐答案

来自 www.jspwiki.org

参见:ActiveDirectoryIntegration

在 server.xml 中使用您的 ldap-settings 试试这个:

Try this in the server.xml with your ldap-settings :

<Realm className="org.apache.catalina.realm.JNDIRealm" debug="99"
    connectionURL="ldap://youradsserver:389"
    alternateURL="ldap://youradsserver:389"         
    userRoleName="member"
    userBase="cn=Users,dc=yourdomain"
    userPattern="cn={0},cn=Users,dc=yourdomain"
    roleBase="cn=Users,dc=yourdomain"
    roleName="cn"
    roleSearch="(member={0})"
    roleSubtree="false"
    userSubtree="true"/>

并在你的应用的tomcat-users.xml和web.xml中定义角色

And define the role in the tomcat-users.xml and the web.xml of your application

编辑webapp_root/WEB_INF/Web.xml文件如下:

<security-constraint>
   <display-name>your web app display name</display-name>
   <web-resource-collection>
     <web-resource-name>Protected Area</web-resource-name>
     <url-pattern>*.jsp</url-pattern>
     <url-pattern>*.html</url-pattern>
     <url-pattern>*.xml</url-pattern>
   </web-resource-collection>
   <auth-constraint>
     <role-name>yourrolname(ADS Group)</role-name>
   </auth-constraint>
 </security-constraint>
 <login-config>
   <auth-method>FORM</auth-method>
   <form-login-config>
     <form-login-page>/login.jsp</form-login-page>
     <form-error-page>/error.jsp</form-error-page>
   </form-login-config>
 </login-config>
 <security-role>
   <description>your role description</description>
   <role-name>yourrolename(i.e ADS group)</role-name>
 </security-role>

这篇关于配置 Tomcat 以使用 Windows Active Directory 进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆