Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Security / July 2004

Tip: Looking for answers? Try searching our database.

Problems with forms authentication on tomcat 5

Thread view: 
Flare - 01 Apr 2004 22:00 GMT
Hi I have tried all night to make tomcat authenticate a user trough mysql
using forms_auth

But I cant get it to connect to my mysql database. I have follewed these
tutorials:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/realm-howto.html#JDBCRealm
http://www.onjava.com/pub/a/onjava/2002/06/12/form.html

i have copied the har file with the mysql JDBC driver  into /server/lib

I have set up the server.xml file with this:
----------------------------------------
<Realm className="org.apache.catalina.realm.JDBCRealm"
debug="99"
driverName="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://192.168.0.1:3306/authority?user=xxxx;password=xx
xx"
userTable="users"
userNameCol="user_name"
userCredCol="user_pass"
userRoleTable="user_roles"
roleNameCol="role_name"/>

I have created the tables and filled them with data. I have assured that i
can connect to the mysql db from my test machine. I have set up the web.xml
with the what you see in the bottom of this post:

The problem is that when I press the submit buttom on my login page it
immidatly redirects my to the errorpage. I can see with a port monitor that
no calss to the database have been tried. So i presume that the problem is
in the server.xml file...but I cant figure what. anything that usally goes
wrong?

Best regards Andes, Denmark

-------- WEB.XML -------------
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Formauth</display-name>
<servlet>
<display-name>formauth</display-name>
<servlet-name>formauth</servlet-name>
<jsp-file>/index.jsp</jsp-file>
</servlet>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>PUT</http-method>
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>staffmember</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<!--<realm-name>default</realm-name> -->
<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>
<role-name>staffmember</role-name>
</security-role>
</web-app
kperico - 15 Jul 2004 16:59 GMT
Hello Flare,

   I've got the same problem as you. Did you find a solution? If so, let
me know, please.

   Best regards,

        Pablo


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.