Implementing Token and Role Base Authentication Using Spring Boot + JWT+ MySQL

Опубликовано: 25 Октябрь 2024
на канале: Learn Programming Yourself
153,160
2.7k

Let's understand, how to implement token and role base authentication mechanism using spring security, jwt and mysql database. In this session, we are going to build a real time application to perform jwt token and role based authentication mechanism.

In this session, I have discussed following points.
1. What is authentication and authorization in an application?
2. How to implement token and role base authentication

For the people looking for time lines in the tutorial:
0:00 App walkthrough
8:24 App flow and tools used
10:24 Project creation
13:30 Dependencies and pom.xml
16:24 Setting up application.properties
17:21 Creating DB
20:15 Back to setting up application.properties
22:50 Package structuring
24:13 Creating entity - Role
26:40 Creating RoleController
29:00 Creating RoleService
29:58 Creating RoleDao
41:56 Creating entity - User
48:54 Creating UserController
50:00 Creating UserService
50:51 Creating UserDao
58:03 init method for DB data
1:14:00 Creating forAdmin and forUser endpoint in UserController
1:17:44 Adding JWT and Spring security dependency in pom.xml
1:18:53 Configuring Spring boot project to enable JWT and spring security
1:19:43 Global Cors configuration
1:24:42 Creating JwtAuthenticationEntryPoint class
1:27:05 Creating WebSecurityConfigurer class
1:46:52 Implementing JwtRequestFilter
1:52:04 Creating Utility to fetch from Jwt Token
2:18:23 Creating JwtController, JwtRequest and JwtResponse entity
2:45:41 Password encryption
2:51:57 Testing the application

Disclaimer - The music/audio used(if any) in this video is not a property of "Learn Programming Yourself". All credit goes to owners of respective music/audio. This music/audio is not prone to any "Copyright Strikes".

#springsecurity #jwt #authentication #authorization

------------------------------------------------------------------------------------------
Here're links to git repo
1. jwt-youtube (Spring Boot)
https://github.com/team-learn-program...

2. jwt-youtube-ui (Angular)
https://github.com/team-learn-program...

--------- Links to my other FREE courses. ---------
▶ Java 8 Full Course -    • Java 8  
▶ JDBC Full Course -    • 1. Introduction to JDBC in java | Use...  
▶ Microsoft Cognitive Services Course -    • Computer Vision + Angular | Microsoft...  
▶ JWT in Spring Boot and Angular -    • How to download and install Angular C...  
▶ CRUD Operations in Spring Boot and Angular (Full Stack) -    • 1. Angular 16 and Spring Boot 3 Crud ...  
▶ Console Based Banking Application Using Java -    • Developing Console Based Banking Appl...  
▶ E-Commerce Application Development Using Angular and Spring Boot (Full Stack) -    • 1. Developing E-Commerce Application ...