Spring Security Form-Based Authentication
Form-Based authentication is a way in which user's authentication is done by login form. This form is built-in and provided by spring security framework.
The HttpSecurity class provide a method formLogin() which is responsible to render login form and validate user credentials.
In this tutorial, we will create an example that implements form-based authentication. Lets start the example.
Create a Maven Project
First create a maven project by providing project details.
This project initially looks like this:
Spring Security Configuration
Configure spring security in the application by using the following Java files. Create a package com.javatpoint and put all the files into it.
Create a controller HomeController and put inside the com.javatpoint.controller package. It contains the following code.
This project contains the following two view (JSP pages). Put these into WEB-INF/views folder.
After adding all these files the project structure looks like this:
Run the application over the server and see it produces the following output to the browser.
Click on link, a login form is rendered that will use for form-based authentication.
After validating credentials it authenticate the user and render to the admin page.
Next TopicSpring Security Remember Me