
spring-security-web: This component integrates the Spring Security to the Servlet API.spring-security-config: It is used for configuring the authentication providers, whether to use JDBC, DAO, LDAP etc.Most of the times, you won’t need it though. spring-security-taglibs: Spring Security tag library, I have used it to display user roles in the JSP page.For complete example of it’s usage, please refer Spring DataSource JNDI Example spring-jdbc: This is used for JDBC operations by JDBC authentication method.
We have following dependencies related to Spring Framework. We would also need to configure JDBC DataSource as JNDI in our servlet container, to learn about this please read Tomcat JNDI DataSource Example. INSERT INTO `Employees` (`username`, `password`, `enabled`) `enabled` tinyint(1) NOT NULL DEFAULT '1', `password` varchar(20) NOT NULL DEFAULT '', `username` varchar(20) NOT NULL DEFAULT '',

We will look into three spring security authentication methods.įor JDBC, I am using MySQL database and have following script executed to create the user details tables. Once we will have our application secured, final project structure will look like below image. If you are unfamiliar with these steps, please refer Java Web Application Tutorial. Make sure to convert it to maven project because we are using Maven for build and deployment.

Create a web application using “ Dynamic Web Project” option in Eclipse, so that our skeleton web application is ready. We will create a web application and integrate it with Spring Security.

We can use spring security in any servlet based web application. Spring Security provides ways to perform authentication and authorization in a web application.
