Skip to content

Sample code demonstrating how to use Form authentication using the JDBC Realm in Tomcat.

Notifications You must be signed in to change notification settings

mtedder/FormAuthJDBCRealm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FormAuthJDBCRealm

Sample code demonstrating how to use Form authentication using the JDBC Realm in Tomcat.

Steps explaining how this project was created and configured

  1. Use the tomcatAuth.sql script to create database and tables with sample data
  2. Create a dynamic Web project and select "Generate web.xml deployment descriptor" in the Web Module dialog
  3. Create an error.jsp, login.jsp and SecuredPage.jsp in the WebContent folder of your dynamic Web project
  4. Add the following form to the login.jsp page
Username: Password:
  1. Add the following code to your Dynamic Web Project Web.xml located in the WebContent-> WEB-INF folder My Secured Page /SecuredPage.jsp GET POST

    admin
FORM /login.jsp /error.jsp
  1. Make a backup copy of your server's server.xml file. Add the follwing code to your Server's server.xml file (if this code already exist in your server.xml you only need to modify the settings) in the "apache-tomcat-8.0.32 at localhost-config" folder of the Eclipse Servers folder. Change the user and password parameters to the values for you MySQL database

  2. Copy the mysql-connector-java-5.1.37-bin.jar to your Apachie Tomcat lib folder

  3. Deploy the application. Start the server and navigate to the following url to assess the application: http://localhost:8080/yourProjectNameGoesHere/SecuredPage.jsp

  4. Test login by using the incorrect credentials to test that the error page displays

  5. Test login using the correct credentials of tomcat for the username field and password for the password field

About

Sample code demonstrating how to use Form authentication using the JDBC Realm in Tomcat.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages