[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Tomcat user authentication.
Hi world,
To setup tomcat user authentication, you need to do the following:
1) Create a conf/apps-<appname>.xml that contains the following:
<?xml version="1.0" encoding="ISO-8859-1"?>
<webapps>
<Context path="/tmexwebui" docBase="webapps/appname" reloadable="true" >
<SimpleRealm filename="conf/users/appname-users.xml" />
</Context>
</webapps>
2) Create a conf/users/appname-users.xml that looks like:
<tomcat-users>
<user name="username" password="passwd" roles="rolename" />
</tomcat-users>
3) Insert the following in the webapps/appname/WEB-INF/web.xml
<security-constraint>
<web-resource-collection>
<web-resource-name>user-resource</web-resource-name>
<description>pages which require login</description>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.html</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<description>Must authenticate before querying the system</description>
<role-name>rolename</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>default</realm-name>
</login-config>
<security-role>
<description>Any user of the system</description>
<role-name>rolename</role-name>
</security-role>
Note that you will have to ensure the <role-name> section points
to the roles you created the users at, and you may need to
add another <url-pattern> section if you have, for example,
.event files. The default simply authenticates *.jsp and
*.html, both for GET and POST.
Thanks,
Brad
--
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
|Brad Marshall | Plugged In Software|
|Senior Systems Administrator | http://www.pisoftware.com|
|mailto:bmarshal@pisoftware.com | GPG Key Id: 47951BD0 / 1024b|
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+
Fingerprint: BAE3 4794 E627 2EAF 7EC0 4763 7884 4BE8 4795 1BD0