473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

tomcat authentication question

I'm fairly new to configuring server.xml and web.xml files in tomcat 4.

I am trying to require password authentication for access to a
subdirectory called "update" located within ROOT. I want all files
located directly in ROOT to be available without a password. I am having
trouble determing the correct path to use for the <url-pattern> in the
web.xml file in WEB-INF so that only the files in the subdirectory
"update" within ROOT are password protected.

If I use <url-pattern>/*</url-pattern> then no pages on the site may be
accessed without a password no matter their location. I am presuming
that this means I have set up the basic authentication correctly in
tomcat-users.xml, server.xml (in conf) and web.xml (in WEB-INF) but that
I now simply need to put the correct path into the <url-pattern> in
web.xml.

However, when I use <url-pattern>/update/*</url-pattern>, I can access
all of the pages within the update directory without being asked for a
password. I've experimented with many different paths and have not had
luck with any. I have been careful to close my browser and open a new
one each time between tests. I've also tried restarting tomcat for every
new test. Nothing works.

In my server.xml file, <Realm
className="org.apache.catalina.realm.MemoryRealm" /> is located within
the <Engine> tag (not within <Host> or <context>).

Have hunted around for a solution without much luck. I assume that I am
missing something very simple.

Here is my complete web.xml file...

<web-app>
<display-name>SMUpdate App webxml</display-name>
<!-- form login security tags -->
<security-constraint>
<web-resource-collection>
<web-resource-name>SMUpdate</web-resource-name>
<url-pattern>/*</url-pattern> <!-- this works but causes password
to be required for access to all pages on entire site -->
</web-resource-collection>
<auth-constraint>
<role-name>smupdate</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>SMUpdate</realm-name>
</login-config>
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
</web-app>

Any suggestions would be very much appreciated.

Thanks.
Jul 17 '05 #1
0 3299

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Captain | last post by:
How do you junit test a container managed security (2.3. Servlet) environment within Tomcat 4.1.x using JUnit?? I.e. form based authentication. I had expected the following to work... but alas...
0
by: Kevin Sagon | last post by:
I am running a J2EE Web App under Tomcat 4.1 with Apache 2.0 proxying requests. Everything is configured and working appropriately however I ran into a problem after configuring J2EE Form...
0
by: Pascal Fluck | last post by:
Hello, I have a problem with IIS (I think): I'm doing a servlet that work under Tomcat 4.1. She ask for authentication and check in a database for user and password. She work fine directly...
6
by: DaiIchi | last post by:
I'm using Tomcat in standalone mode. When a URL without a filename is entered into the browser (ie. "http://myhost.mydomain.com"), and the default path does NOT have an index.html, but rather an...
0
by: Edu | last post by:
Hi all, I had working a servlet that transformed xml data into wml or html (depending on the client browser). Everything was OK, but today I tried to add authentication before using the servlet....
0
by: AlexTengco | last post by:
Hi All, I'm not sure if this is the right group to ask this question, but I'll give it a try. I'm currently developing a dotnet web app. Using custom authentication like this: ...
0
by: Michael Oliver | last post by:
I am trying to write a Python client to access a Tomcat servlet using Tomcat Realm authentication with no success. I can use the httplib to connect to localhost port 8080 ok and post and get...
1
JohanK
by: JohanK | last post by:
Hi guys, I need some help with authentication in tomcat. I have set up the security constraints in the WEB.XML and created the users in the tomcat-users file and set the server.XML to use the menory...
0
by: gitocoby | last post by:
hi, a simple question: can i use two authentication realms, JDBC Realm and UserDatabase Realm, in one only tomcat server?
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.