Building a Secure Web Application: Role-Based Authentication with User Registration and Login

preview_player
Показать описание
Hello everyone , hope you all are doing great . So , in this video we will learn to implement Role Based Authentication With User Registration and Login .

Hope that you people like the video , it takes a lot of efforts to Oversimplify the Topics and represent on the video . Hoping that my Channel gets your support .

Like , share and comment .

Would love to read your Comments and answer back .

Do Support the channel by Hitting the SUBSCRIBE Button .

Thank You . Happy Learning .
Рекомендации по теме
Комментарии
Автор

🎯 Key Takeaways for quick navigation:

00:00 🚀 *Overview of the Video and Query Request*
- Request for query suggestions and support.
- Introduction to the topic of role-based authentication in a Spring Boot application.
- Encouragement for viewers to like, comment, share, and subscribe.
01:09 📦 *Project Structure and Dependencies*
- Overview of project structure and main class in a Spring Boot application.
- Explanation of dependencies in the pom.xml file, including JPA, Spring Security, Thymeleaf, and MySQL Connector.
- Introduction to the user entity structure and its relationship with roles.
02:42 🗺️ *User-Role Many-to-Many Mapping*
- Explanation of the many-to-many mapping between the user and role entities.
- Discussion on the role table and its types (e.g., user, admin).
- Detailed explanation of the @JoinTable, @JoinColumn, and @InverseJoinColumn annotations.
06:10 📁 *Data Transfer Object (DTO) in Spring Boot*
- Definition and purpose of Data Transfer Objects (DTOs).
- Importance of using DTOs for data transfer between UI and database.
- Brief overview of the registration and login DTOs used in the application.
07:31 🎮 *Registration Controller and User Registration Flow*
- Explanation of the Registration Controller's mapping and usage of @GetMapping and @PostMapping.
- Overview of the user registration flow, from displaying the registration form to saving user details.
10:36 🔐 *Login Controller and User Login Flow*
- Introduction to the Login Controller and its @GetMapping and @PostMapping mappings.
- Explanation of the user login flow, including the use of UserLoginDetail and authentication logic.
- Usage of UserDetailsService to load user details and validate credentials.
13:50 📊 *Dashboard and Admin Controllers*
- Overview of the Dashboard and Admin Controllers with simple @GetMapping mappings.
- Brief explanation of roles determining which screen (dashboard or admin) is displayed to the user.
15:12 🔒 *Spring Security Configuration*
- Explanation of Spring Security configuration using BCrypt password encoder.
- Introduction to DaoAuthenticationProvider, authentication success handler, and role-based redirection.
- Overview of the security configurations for registration, login, and logout.
18:41 🔄 *Custom Authentication Success Handler*
- Explanation of the custom Authentication Success Handler and its role in redirecting users based on their roles.
- Implementation of logic to determine redirect URLs for users with different roles.
- Handling cases where the user has no assigned role.
20:30 🖥️ *HTML Form for User Registration*
- Mention of the registration.html containing a simple form for user registration.
- Discussion on the form elements, including name, email, password, and role input fields.
20:43 📝 *Overview of Registration and Login HTML:*
- The presenter introduces the registration and login HTML pages.
- Registration HTML includes fields for name, email, password, and user role selection.
- Login HTML includes fields for email and password.
21:24 🚧 *Database Schema Configuration:*
- The presenter explains the MySQL database configuration properties in the application.properties file.
- The schema name is set to "role based authentication."
22:21 🗄️ *Database Table Creation:*
- The presenter starts the application, showing the creation of tables in the database.
- Discusses the tables, including the user, role, and the common user_role mapping table.
23:43 📥 *User Registration Flow:*
- Explains the registration flow when a user submits the registration form.
- Details the logic in the registration controller, user service, and the saving process to the repository.
24:54 🔄 *User Login Flow:*
- Details the login flow, explaining the post mapping call in the login controller.
- Walks through the load user by username method in the default user service implementation.
25:21 🎯 *Custom Success Handler Logic:*
- Describes the logic in the custom success handler based on user roles.
- Redirects users to the appropriate dashboard (admin or user) after a successful login.
26:15 🚪 *Logout Process:*
- Shows the logout process and how the application logs out the user.
26:30 🔄 *User Registration with Role "User":*
- Demonstrates the registration process with the role set to "user."
- Checks the database entries for user and role tables.
27:22 🔄 *User Login as "User":*
- Shows the login process for a user with the role "user."
- Explains how the custom success handler redirects to the user dashboard.
28:18 🌐 *Closing Remarks:*
- The presenter concludes the explanation, summarizing the coverage of role-based authentication and many-to-many relationships.
- Encourages viewers to like, share, comment, and subscribe to the channel if new, expressing hope that the concepts were well understood.

Made with HARPA AI

Me-ktgh
Автор

Bro, Thank you for the video, it is helping many programmers.

If possible, can you make it with latest spring boot version along with simple react application integration ?

lqyokqh
Автор

i have clone your github. i run the application but it does not work properly. please help me

jankipatel
Автор

roles are not saving in DB. Can you please help?

santoshghawate
Автор

Thanks bro 👍
Next video add this application+ ouath2 security please

bhavanisankar
Автор

what if we just add another field in user table as role.

parthgoel
Автор

"But you people are not supporting my videos" i sensed frastration there😂😂

levybronzoh
Автор

How can I implement Spring Security configs without WebSecurityConfigurerAdapter

prashyt
Автор

vaiya make a project with jew+ mapping, + role base authentication

anupambiswas