Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring Tomcat to authenticate using Windows Active Directory

Tags:

tomcat

ldap

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

like image 623
santtu Avatar asked Nov 06 '08 07:11

santtu


People also ask

What is the authentication used by tomcat for Integrated Windows Authentication?

The client must be configured to use Kerberos authentication. For Internet Explorer this means making sure that the Tomcat instance is in the "Local intranet" security domain and that it is configured (Tools > Internet Options > Advanced) with integrated Windows authentication enabled.

Does Windows Authentication use Active Directory?

You can use Windows authentication when your IIS 7 server runs on a corporate network that is using Microsoft Active Directory service domain identities or other Windows accounts to identify users. Because of this, you can use Windows authentication whether or not your server is a member of an Active Directory domain.


1 Answers

From www.jspwiki.org

See : ActiveDirectoryIntegration

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"/> 

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

Edit webapp_root/WEB_INF/Web.xml file as follows:

<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> 
like image 178
Blauohr Avatar answered Sep 20 '22 14:09

Blauohr