Spring Boot 3 + Spring Security 6 - JWT Authentication and Authorisation [NEW] [2023]

preview_player
Показать описание
In this video, you'll learn how to implement JWT authentication and authorization in a Spring Boot 3.0 application using Spring Security 6 and a Postgres database to store user credentials.

You'll see how easy it is to secure your application and protect your endpoints using JSON Web Tokens. We'll start by setting up a Postgres database and creating a user table to store our credentials.

Then, we'll configure Spring Security to use JWT and define some security rules for our application. Finally, we'll test our setup by building a simple API and using Postman to send authenticated requests.

Whether you're a beginner or an experienced developer, this tutorial will give you the tools you need to secure your Spring Boot application with JWT authentication and authorization.

#springboot3 #springsecurity #jwt

Don't Forget to
===========================================

⭐ Table Of Contents ⭐
===========================================

🙊 Here are the goods for all my videos video 🙊

► Recommended Books
===========================================

► Computer and Monitor
===========================================

► Camera Gear
=============================================

► IDE & Tools I use for coding 💻 🎒
===========================================
- ITerm
- VsCode
- GoLand
- IntelliJ Ultimate
- Sublime

P.S
===========================================

❤️ Thanks for watching
Рекомендации по теме
Комментарии
Автор

Table of content
00:00 Intro
01:55 How JWT security works
07:26Create a new spring boot 3.0 project
09:28 Add Data source
12:28 Connect to the database
17:12 Create user class
20:05 Transform the User to an entity
25:22 Extend the user to UserDeatils object
33:32 Create the user repository
35:50 Create the JWT authentication filter
40:58 Checking the JWT token
44:32 Create the JWT service
47:56 Add the JJWT dependencies
49:59 What is a JWT token
53:06 Extract claims from JWT
55:23 Implement the getSignInKey method
01:00:07 Extract a single claim from JWT
01:01:51 Extract the username from the token
01:02:52 Generate the JWT token
01:08:15 Check if the token is valid
01:11:22 Check the user existence in the database (JwtAuthFilter)
01:15:13 Implement the UserDetailsService
01:19:38 Update the SecurityContextHolder and finalise the filter
01:23:53 Add the security configuration
01:32:51 Create the authentication provider bean
01:36:41 Create the authentication manager bean
01:38:14 Create the authentication controller
01:40:55 Create the authentication response class
01:41:47 Create the register request object
01:42:50 Create the authentication request class
01:43:22 Create the authentication service
01:45:37 Implement the register method
01:49:28 Implement the authenticate method
01:52:17 Update the security configuration whitelist
01:53:35 Create a demo controller
01:54:55 Test the changes

akramseid
Автор

I watch alot of your videos but the long ones I have never stuck to this one I stuck though the whole video and followed along every step of the way and understood everything I am so glad you done it as I followed ur example now going to be able to implement it in my own project!

LifeOfMohammed
Автор

Absolutely what I've been looking for. Just the right amount of high level explainations for someone who's just getting into Spring. Thank you for the amazing content.

ofastora
Автор

I just started watching you, but I'm already glad I'm doing it with your style of lessons, it's awesome! Thank you so much! Hello from Ukraine!

TheEBPO
Автор

This tutorial is the one I have been looking for. I spent hours looking for a way to implement spring security, however, most of the spring security tutorials that I found are outdated. Luckily, I stumble on this amazing work, my man here explained everything in depth and comprehensible. Thanks for the tutorial and keep up the good work!!

maitoshikigami
Автор

Great tutorial. To the point and everything is explained. Easy to follow. Great job!!

antoniobukovac
Автор

Quality content. Thank you very much! Your channel is one of the best on YouTube for learning Java and Spring.

GROOVETECHSETS
Автор

This course is awesome, thank you. More detailed and clearer than the previous one.

david_kariuki
Автор

Yesterday, I watched your previous video about Spring Security and realized that some functions are deprecated in the latest Spring Security. And I'm astonished that you uploaded an updated video today. I'm planning to build a blog website for my own and review Spring Security as well, so this video is excellent for many other developers who love Spring and for me. Keep up your great job, and wish you much luck. Happy new year🤩!

quantmvo
Автор

Such a helpful, important video. Just got new into creating websites with Spring and it's such the best video seen so far! Can really recommend it to everyone.

SaltyFeaRz
Автор

You never disappoint. Of all spring security tutorials this is the one that make sense for me. Also, usage of lombok and an actual database (not in-memory one) is a plus.

USONOFAV
Автор

I was almost giving up on understanding Spring Security but now I feel like I have an eagle's eye view of what's what based on this and a number of other tutorials from other channels. Keep doing the good work.

dennismasinde
Автор

I watched this video when it was released 10 months ago, and I didn't quite understand the concept, but watching it again 10 months later and understanding a lot more than last time makes me think I'm doing great progress! Thank you for the amazing content, keep up the good work!

juliocesarvieirasantos
Автор

You're amazing dude! You saved my diploma project with your work. Everything worked on the first try and taking the time to update this guide is just... great of you. If you are ever in Sofia let me buy you a beer. :D

watchdennyplay
Автор

This is unique, definitely what I was looking for, I appreciate the time you spend doing this course

ezoz
Автор

What's going on with SpringSecurity? "HttpSecurity" is also marked for removal... All tutorials become obsolete after a few months.

GROOVETECHSETS
Автор

Hey AmigosCode, I congratulate you for this tutorial, for those who see the negative side of the Internet, this is a sign of generosity, and we must be grateful for that, thanks and regards!!!

guillermoguir
Автор

I would like to take the time to thank you and say that I appreciate you for your content. It's wholesome and helps me a lot!

lloyd
Автор

I was so thankful for this video literally I was struggling with jwt you made everything crisp and clear💯

mohammedharoon
Автор

Прекрасное и внятное объяснение данной темы! Огромная благодарность автору👍👍👍

lxdclse