Java J2EE Portal
Enterprise Java Station
J2EE curve
Java News / Articles
Java News / Articles
Java Cryptography : A Bird's Eye View
Excited About EJB 3.1 & JSF 2.0?
Building JSF and EJB3 applications using the JBoss Seam framework
Processing...
Buy Java, Deals On Software Technology Store
Click here for great deals on computers, laptops, software and books
Setting up Secure Web Authentication in Tomcat PDF Print
Written by Atul Kahate   
Apr 18, 2007 at 10:17 AM

Step 4: Enable SSL connections via the web.xml file

The last step signifies that we want to enable SSL connections on our Tomcat installation. For this purpose, in the same web.xml file, add the following (or uncomment, if already present).

<Connector port="8443" maxHttpHeaderSize="8192"

maxThreads="150" minSpareThreads="25" maxSpareThreads="75"

enableLookups="false" disableUploadTimeout="true"

acceptCount="100" scheme="https" secure="true"

clientAuth="false" sslProtocol="TLS" />

This specifies that port 8443 should be opened for receiving TLS requests (TLS is a modified version of the SSL protocol) using the https method, instead of the traditional http.

Provided we have done everything specified earlier correctly, our job is done! Now, restart Tomcat, open browser, and type the appropriate URL for Test.jsp. This should redirect our request to port 8443, and show us the following screen.

Certified by unknown authority

Click on OK. It should display the following screen.

Domain Name Mismatch

We can view the certificate details by clicking on the said button above. This will show us the details of the certificate the way we had provided earlier. If we click on OK, the following screen appears.

Authentication Required

This proves that we are being asked for the user id and password (i.e. authentication is enabled) and also that SSL is being used (from the URL mentioned in the above screen).

If we provide the right user id and password (as specified in step 1 earlier), we would be allowed access to Test.jsp. Otherwise, we would be told that authentication has failed.

That is all that takes us to enable secure user id-password based and SSL-enabled authentication in Tomcat.

Related -
Returning Arrays or Objects - A Security Problem in Java
Using the Java ByteCode Verifier To Prevent Malicious Access

---
AtulKahate-JavaSecurityArticleAtul Kahate writes about Java Security in this monthly column on IndicThreads.com. Atul is the author of 13 books including "Cryptography and Network Security".

He is currently a Project Manager at i-flex solutions limited, Pune, India. Atul can be reached at (akahate at gmail dot com)

---
User Comments

Comment by GUEST on 2008-05-21 03:08:34
i have a java programs,oath signature also,herongyang crypto programs etc,how can i use this to sign a file ,how to prepare a software to sign automatically, any familier .com is there please help me,,,,, my email id is :narendra.bala@gmail.com 

Comment by ajith.ngl@gmail.com on 2008-07-18 04:02:21
Hi i could not able to create a keystore file. i am getting Filenotfoundexception. ANy help?

Comment by bhargeshmehta@yahoo.com on 2008-09-19 04:07:05
Too much good artical.

Comment by Anonymous on 2008-09-23 03:08:08
Step 2 mentions about creating the keystore file. But I could not find out how the keystore is getting linked to the web application. Do we specify the file name in any of the web app property files.

Comment by sandeep on 2008-10-07 00:42:54
hey, is there another way for authentication in tomcat. e.g. apache authentication htpassword file.
Your Name / Email Address
Comment
Spam Protection - Please enter the code in the image -

Listen to code




Add This Feed Button

Enter your Email


Java Expert Interviews
The future of the Java platform lies in the mobile world
Debu Panda - Oracle
Oracle Application Server is the fastest
RoelStalmanOracleJDeveloper
JDeveloper is the most comprehensive Java IDE available
Processing...
Go to top of page  Home |
SiteMap

Copyright 2004 to 2008 Rightrix Solutions. All rights reserved. All product names are trademarks of their respective companies. Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. Rightrix Solutions and IndicThreads.com are independent of Sun Microsystems, Inc.

Views expressed at IndicThreads.com reflect the views of the authors alone, and do not necessarily reflect those of IndicThreads.com. IndicThreads.com and it's authors are not responsible for reader comments and opinions.

Enterprise Java J2EE JEE Portal >> IndicThreads.com