Spring Security Form Login
1. Introduction
This article is going to focus on Login with Spring Security.The implementation of this Spring Login tutorial can be found in the GitHub project – this is an Eclipse based project, so it should be easy to import and run as it is.
Demo:http://localhost:8080/SpringSecurity-csrf/
On successful login,user is redirected to the next page.
Directory Structure:
2. The Maven Dependencies
- spring-security-core : It contains core authentication and access-control classes and interfaces.
- spring-security-web : It contains filters and related web-security infrastructure code. It also enable URL based security which we are going to use in this demo.
- spring-security-config : It contains the security namespace parsing code. You need it if you are using the Spring Security XML file for configuration.
3. Spring Security Java Configuration
Let’s start by creating a Spring Security configuration class that extends WebSecurityConfigurerAdapter. By adding @EnableWebSecurity,we get Spring Security and MVC integration support.
We can have multiple authentication managers defined in the spring security configuration. I have defined in-memory-auth for in-memory authentication.
DemoSecurityConfig.java
This post first appeared on Learning Help You To Achieve Your Biggest Goals, please read the originial post: here