O'Reilly logo

Spring Security 3.x Cookbook by Anjana Mankale

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Authenticating databases with Struts 2 and Spring Security

In this section, let us authorize the user who logs into the Struts 2 application using the information stored in the database. Spring Security needs to be configured in Struts 2 application such that it gets to know the location of the database and SQL that needs to be executed to authenticate the user using Spring Security.

Getting ready

  • Create a dynamic web project in Eclipse: Struts2_Spring_DBAuthentication_Recipe4
  • Copy the struts.xml file to src/main/java
  • Add the db-beans.xml file to WEB-INF
  • Copy the webContent folder from the previous recipe
  • Add the following JARs into the lib folder or update your POM file if you are using maven:
    • spring-jdbc-3.0.7.RELEASE
    • mysql-connector-java-5.1.17
    • commons-dbcp ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required