Login and Registration Example Project with Spring Security
If you're already a student of Learn Spring Security, you can get started diving deeper into registration with Module 2
If you're not yet a student, you can get access to the course here: http://bit.ly/github-lsso
Relevant Articles:
- Spring Security Registration Tutorial
- The Registration Process With Spring Security
- Registration – Activate a New Account by Email
- Registration with Spring Security – Password Encoding
- Spring Security – Roles and Privileges
- Prevent Brute Force Authentication Attempts with Spring Security
- Spring Security – Reset Your Password
- Spring Security Registration – Resend Verification Email
- The Registration API becomes RESTful
- Registration – Password Strength and Rules
- Updating your Password
- Registration - Integrate reCAPTCHA
- Two Factor Auth with Spring Security
- Registration with Spring – Integrate reCAPTCHA
- Purging Expired Tokens Generated By The Registration
- Custom Login Page for Returning User
- Allow Authentication from Accepted Locations Only with Spring Security
- Spring Security – Auto Login User After Registration
- Keep Track of Logged In Users with Spring Security
- Login For a Spring Web App – Error Handling and Localization
- Notify User of Login From New Device or Location
- Preventing Username Enumeration Attacks with Spring Security
Build and Deploy the Project
mvn clean install
This is a Spring Boot project, so you can deploy it by simply using the main class: Application.java
Once deployed, you can simply access the app at:
Set up MySQL
mysql -u root -p
> CREATE USER 'tutorialuser'@'localhost' IDENTIFIED BY 'tutorialmy5ql';
> GRANT ALL PRIVILEGES ON *.* TO 'tutorialuser'@'localhost';
> FLUSH PRIVILEGES;
Set up Email
You need to configure the email by providing your own username and password in application.properties You also need to use your own host, you can use Amazon or Google for example. You may also setup an email server locally. See "email.properties.localhost.sample" for more details.
AuthenticationSuccessHandler configuration for Custom Login Page article
If you want to activate the configuration for the article Custom Login Page for Returning User, then you need to comment the @Component("myAuthenticationSuccessHandler") annotation in the MySimpleUrlAuthenticationSuccessHandler and uncomment the same in MyCustomLoginAuthenticationSuccessHandler.