Spring boot 3.0 - Secure your API with JWT Token [2023]

Поделиться
HTML-код
  • Опубликовано: 22 ноя 2024

Комментарии • 790

  • @BoualiAli
    @BoualiAli  Год назад +3

    Join the Micro Services course waiting list and get and get an exclusive *EARLY-BIRD discount*
    aliboucoding.ck.page/d0f9317e13

  • @kenkaneki669
    @kenkaneki669 Год назад +56

    You have no idea how much you have helped me. Due to other tutorials being backdated, I just couldn't find a proper step by step procedure on how to implement jwt in spring boot. You saved my university major project. I wish you lifetime of happiness and health.

    • @BoualiAli
      @BoualiAli  Год назад +10

      Really happy you liked it

    • @aeroabrar_31
      @aeroabrar_31 Год назад

      @@BoualiAli A small error check : the token will get expired in only 24 minutes not 24 hours. Apart from that everything is crystal clear.

  • @ibrahimabdellatif186
    @ibrahimabdellatif186 7 месяцев назад

    جزاك الله خير
    It's amazing content

  • @let1742
    @let1742 Месяц назад

    Thank you !!! all others tutorial were not clear at all, I love the fact that you explain each thing you use
    Next step is to retrieve user info based on the authenticated user

  • @juldasramde9057
    @juldasramde9057 3 месяца назад

    The best course you'll find anywhere. Thank you Alibou !

    • @BoualiAli
      @BoualiAli  2 месяца назад

      Glad you think so!

  • @joypedze2320
    @joypedze2320 Год назад +5

    I just finished this tutorial and trust me, if you want to learn about Spring Security using JWT, this is the way. Thanks @Bouli Ali for such awesome content

    • @BoualiAli
      @BoualiAli  Год назад +1

      I really appreciate your great and honest feedback.
      This keeps me motivated to provide more and better content

  • @soukainaj
    @soukainaj 4 месяца назад

    Thank you for this amazing tutorial, i had a hard time understanding the process behind spring security, but you explained it very well and didn't just focus on the code itself

  • @eddykokokenfack1362
    @eddykokokenfack1362 Год назад

    Amazing course, i get all workflow about jwt spring security, how to extractAllClaims, single claims, how to use JWTAuthenticationFilter and more. Thanks for this update spring security jwt and hope you take care of you!! Great time!!

  • @ivandvoinenko5449
    @ivandvoinenko5449 Год назад +3

    Hello, it was a great step-by-step tutorial. The things that weren't clear to me became clear after I watched this video for the second time. The only moment (just statistical) - the token expiry date wasn't 24h from the moment of creation. 1000 ms -> 1s; 60 * 1000 -> 1m; 60 * 60 * 1000 -> 1h. So adjustment should be settled to 24 * 60 * 60 * 1000. Your token expiry date is 24 m.

    • @BoualiAli
      @BoualiAli  Год назад +1

      True, but just for the sake of the tutorial I removed the *24 to have short living token.
      Sorry for the confusion

  • @rustamnarayan2376
    @rustamnarayan2376 4 месяца назад

    I just finished watching this tutorial, and I'm incredibly impressed by the level of explanation presented throughout the video. Thanks to Bouali, I've been able to successfully complete a task I've been working on for the past week. Thank you so much for your help! You're truly a lifesaver. God bless you!

    • @la-dev
      @la-dev 3 месяца назад

      And how you're going to handle the situation that most of the methods are deprecated now. I'm new and I need you help if it is the right way to learn or this source is already old by now?

    • @rustamnarayan2376
      @rustamnarayan2376 3 месяца назад

      @@la-dev just follow the video and I assure you some googling would rescue you in case there are such issues. However, I did not encounter it as he is using spring boot 3 which is latest :)

    • @la-dev
      @la-dev 3 месяца назад

      Thanks @@rustamnarayan2376

    • @BoualiAli
      @BoualiAli  2 месяца назад

      Just check the latest spring security video

  • @priya-bp5ch
    @priya-bp5ch 5 месяцев назад

    Your tutorials are really helpful for me as a beginner. Thanks a lot!!!
    Your way of teaching is really nice and I feel if you show an implementation video at the start of the tutorial we can easily understand what we are going to build
    Again, thanks a ton!!!!

  • @phanimc11211
    @phanimc11211 Год назад

    Thank you so much for this fantastic Spring Security video!

  • @med4242
    @med4242 2 месяца назад +1

    thanks a lot Ali

  • @theold_new1631
    @theold_new1631 7 месяцев назад

    Thank you from South Korea!

    • @guratete
      @guratete 6 месяцев назад

      how is the job Market in Seoul for Java Devs, I am in China and looking for new opportunities in other countries

  • @swipped99
    @swipped99 6 месяцев назад +5

    It is astonishing with what fast pace spring boot is moving forwards. Alot of the methods shown here are already deprecated and marked for removal.

  • @boomkablamo
    @boomkablamo Год назад +2

    I want to give you a huge thank you. I've been struggling with this for days due to other tutorials being outdated. You really saved the day.

  • @GloomDev
    @GloomDev Год назад

    Gold. 👍
    Thank you.

    • @BoualiAli
      @BoualiAli  Год назад +1

      Happy you liked it!
      Thank you too!

  • @supun_sandaruwan
    @supun_sandaruwan Год назад

    this is the video perfectly understand the spring security for me. Thank you so much @Bouali Ali

  • @lurodev
    @lurodev Год назад

    This is just what I needed, great explanation and the most important, it works!!! , Thanks and greetings from Colombia.

    • @BoualiAli
      @BoualiAli  Год назад

      Great to hear!
      Greetings from 🇹🇳

  • @laminefaty9340
    @laminefaty9340 Год назад

    Intéressant ! mister bouali ...

  • @BKEuphony
    @BKEuphony Год назад

    Too good. Awesome.

  • @abdulloholimov5026
    @abdulloholimov5026 Месяц назад

    super! thank you !

  • @Samuelfanu
    @Samuelfanu Год назад +2

    Thank you so much for this fantastic Spring Security video! It was incredibly helpful and provided me with valuable insights. I really appreciate the clear explanations and the practical examples demonstrated throughout the tutorial. Your expertise and teaching style made it easy for me to grasp the concepts.

  • @loqol5874
    @loqol5874 7 месяцев назад

    thank you very much for the information and excellent explanation

    • @BoualiAli
      @BoualiAli  7 месяцев назад

      Glad it was helpful!

  • @JamesMiller-xs8zz
    @JamesMiller-xs8zz Год назад

    Thank you very much. you save me and my university project. Subscribed

  • @jovaniecabatuan6364
    @jovaniecabatuan6364 Год назад

    OMG this is the most awesome tutorial I've ever watched

    • @BoualiAli
      @BoualiAli  Год назад

      Thank youuuuuu. Happy to know that

  • @anirudh514
    @anirudh514 9 месяцев назад

    Thank you so much, very well explained! Very useful!!

  • @explorer9240
    @explorer9240 5 месяцев назад

    love the way u teach (:

  • @poragjyoti4190
    @poragjyoti4190 Год назад

    This video made all my doubts clear. Thank you so much.

    • @BoualiAli
      @BoualiAli  Год назад

      Really happy you liked it

  • @phanimc11211
    @phanimc11211 Год назад

    Very awesome tutorial, great explanations on the concepts, easy to follow along

  • @tay_fay
    @tay_fay Год назад

    Many thanks! Your tutorials are absolutely fantastic. Pure gold! The content, your delivery and the speed - everything is just perfect. Sending loads of love your way!

  • @josue10hd
    @josue10hd Год назад

    muchas gracias por la explicación y por compartir el repositorio 🤓

  • @mohamednibras53
    @mohamednibras53 Год назад

    Excellent tutorial

  • @MirkoPinseler
    @MirkoPinseler Год назад

    Absolutely great tutorial!

  • @mahmoudotri6103
    @mahmoudotri6103 6 месяцев назад

    baraka al Allahu fik. Keep up the good work!

    • @BoualiAli
      @BoualiAli  6 месяцев назад +1

      my pleasure
      Check the new one, it is more updated with no deprecations

    • @mahmoudotri6103
      @mahmoudotri6103 6 месяцев назад

      @@BoualiAli Awesome! may you share the link for it?

    • @BoualiAli
      @BoualiAli  6 месяцев назад

      @@mahmoudotri6103 check the videos and you will notice it. It is a recent upload

  • @TiagoSilva-ge5cp
    @TiagoSilva-ge5cp Год назад

    Great explanation !! Thank you very much, u're awesome

  • @alexkouasseu6396
    @alexkouasseu6396 Год назад

    Great Job Ali,
    thans is the best Tutorial I ever see.
    I like and Subscribe right now.

    • @BoualiAli
      @BoualiAli  Год назад

      More thank happy to have here

  • @web3made
    @web3made 8 месяцев назад

    awesome tutorial!

    • @BoualiAli
      @BoualiAli  7 месяцев назад

      Glad you liked it!

  • @HamzaAlAzhar
    @HamzaAlAzhar 6 месяцев назад

    I just discovered your channel, what a great content, Allah y3tik lkhir

    • @BoualiAli
      @BoualiAli  6 месяцев назад +1

      Thank you so much 😊

  • @7sudo
    @7sudo Год назад

    thank you khouya, merci beaucoup pour ton effort.

  • @Samuel-ow5jx
    @Samuel-ow5jx 5 месяцев назад

    Thank you Ali!

  • @ahmedelamri5942
    @ahmedelamri5942 Год назад +1

    Great Video, you saved my life on a bug that I've been searching for so long since I migrated to spring 3.0, Keep it up! from Tunisia

    • @BoualiAli
      @BoualiAli  Год назад +1

      My pleasure bro
      I like Tunisian people 🇹🇳

  • @sardorbekyorqulov
    @sardorbekyorqulov 10 месяцев назад

    Thank you so much bro ! Best tutorial I've ever seen.

    • @BoualiAli
      @BoualiAli  7 месяцев назад

      Glad you think so!

  • @furiUfc
    @furiUfc 11 месяцев назад

    Great Video, thanks a lot

    • @BoualiAli
      @BoualiAli  10 месяцев назад

      Glad you liked it!

  • @alvinimbuka8283
    @alvinimbuka8283 Год назад +6

    Very awesome tutorial, great explanations on the concepts, easy to follow along. I have really learned alot Ali. Looking forward to learn more courses on Springboot and Java.

    • @BoualiAli
      @BoualiAli  Год назад +1

      Thank you so much for your feedback 🙏

  • @basalat1131
    @basalat1131 Год назад

    this tutorial is very helpful. thanks a million

  • @michelvandeweetering4450
    @michelvandeweetering4450 Год назад

    Wonderful ! thanks for the effort and clear tutorial!

  • @hafedhbaazouzi3617
    @hafedhbaazouzi3617 Год назад

    thanks for your efforts

  • @777MALexa
    @777MALexa Год назад

    thank you for this video!

  • @ramadaniotfi3537
    @ramadaniotfi3537 Год назад

    Good job ,and i realy appreciate you so much .

  • @paulnzioki8782
    @paulnzioki8782 Год назад

    Amazing content. Thank you for your good work to enable us acquire skills.

    • @BoualiAli
      @BoualiAli  Год назад

      really happy I helped you learn

  • @ablayefaye7157
    @ablayefaye7157 Год назад

    great!

  • @raoufzouaoui6931
    @raoufzouaoui6931 Год назад

    Great work and content! Thank you very much for this.

  • @praveens2272
    @praveens2272 Год назад +1

    I am subscribed

    • @BoualiAli
      @BoualiAli  Год назад

      Really happy you liked it

  • @2RAJ21
    @2RAJ21 2 месяца назад

    Thank you

  • @userjred2866
    @userjred2866 Год назад

    Thanks a lot man, your explanations are the best! Subscribed! I will see the refresh token vid now :)

    • @BoualiAli
      @BoualiAli  Год назад

      Thank you 🙏. Check the spring security playlist for more videos

  • @indranilgoswami1500
    @indranilgoswami1500 Год назад

    Great Video Bouali ! I have learned many things. Subscribed your channel also . Thanks a lot !

  • @juanpablo-mu6wq
    @juanpablo-mu6wq Год назад

    What a great video! you have gained a subscriber forever!

    • @BoualiAli
      @BoualiAli  Год назад

      You’re welcome forever

  • @fahrican9708
    @fahrican9708 Год назад

    really great video!!!! thanks!!! I would adapt the title just put (registration & login) because RUclips does not show your video, when searching for spring boot registration & login

  • @dalikrimi2277
    @dalikrimi2277 Год назад

    Great video Bro keep going 😀😀😍

  • @merxxibeaucoup9093
    @merxxibeaucoup9093 Год назад

    Thank you very much for this. this was great. you have gained a subscriber forever!

    • @BoualiAli
      @BoualiAli  Год назад

      So happy and proud to have you here

  • @ahouzimohamed6387
    @ahouzimohamed6387 Год назад

    Thank you for your efforts, your brother from morocco..
    Keep it up 🙂

  • @MrZeroinside
    @MrZeroinside Год назад +3

    Great video man, I have recently started learning Springboot and there wasn't many content for 3.0 out there, was exactly looking for this, the way you explained everything was very well done and understable, Thanks and Keep it up!

    • @BoualiAli
      @BoualiAli  Год назад

      Thank you for the great feedback.

    • @BoyanDimitrov-g4l
      @BoyanDimitrov-g4l Год назад

      I had the same issue and it turns out I had left User's isEnabled() to false, when it should be true.

  • @andriikorniienko
    @andriikorniienko 5 месяцев назад

    that's perfect, please keep on keeping on!! could you please tell how you learned it and how you would recommend people learn it?? imho documentation usually gives the "What" about everything in it, not "Why"

  • @devynlab
    @devynlab Год назад

    Loving this. Great start as I migrate to Spring Boot 3. Thanks man 🔥.

  • @liberaamoremio
    @liberaamoremio 11 месяцев назад +4

    Thank you so much, I followed this guide and everything works great. I have a question though. In the isTokenValid method of JwtService we check if the username(email) from the parameter userDetails is equal to the username found in the token. However the parameter userDetails is always aquired from the username found in the token (e.g. in AuthenticationService or in JwtAuthenticationFilter). So the way I see it we extract the username from the token and then check if the extracted username is equal to the username found in the token. Wont that always be true?

  • @Ezzedini
    @Ezzedini Год назад +1

    great content, I'll be finishing the one on amigos code cause I'm still using spring 2.7, I'll book this video once I upgrade!

  • @achrefgassoumi4478
    @achrefgassoumi4478 Год назад

    Good job aloulou ;)

  • @hackpiece3094
    @hackpiece3094 Год назад

    This is soooooo long ! Thank you for doing everything step by step but its my request please bring a Course on Spring Security where you can explain things on a slow pace. That would help us get more clarity.

  • @mohammedjoubba318
    @mohammedjoubba318 Год назад

    thank you so much for the course, it is very helpful. I hope you could make a continuation video implementing the APIs in Angular. I 'm really stuck right now

    • @BoualiAli
      @BoualiAli  Год назад +1

      Happy you liked it
      I'm already preparing a video for that

  • @kunamanenisaikrishnakunama6990

    ❤️👏👏

  • @oOalex74Oo
    @oOalex74Oo Год назад

    Amazing course, I learned so much! It is even more amazing the code you gave on github, however I wish I could have some explanations on all the additional stuff there is in the repo

    • @BoualiAli
      @BoualiAli  Год назад

      Happy you liked it!
      Just follow the playlist order and you will get each line of the code

  • @odilhonislomov8954
    @odilhonislomov8954 Год назад

    Thank you 🎉

  • @lucasfkam
    @lucasfkam Год назад +2

    For the Spring Security package to be complete on your channel, could you please make a video explaining how to configure CORS using Spring Security? For example, as routes from other origins that need authentication with the head "Authorization" in the request, I would be very grateful

  • @krige
    @krige Год назад +2

    16:50 You don’t need to specify the driver-class-name since Spring Boot can deduce it for most databases from the url. See Spring Boot 3.0 Data docs.

    • @BoualiAli
      @BoualiAli  Год назад +2

      True, but if I don’t specify it people will ask about and I forgot to mention that in the video.
      Good comment 👍

  • @samymohsen505
    @samymohsen505 10 месяцев назад

    I can't really express how you are amazing Mr. Bouali. The explanation is clear and straight to the point.
    I wanted to ask you if there is a way to not to hit the database for each request as this will be overhead for it. can we make it in the register & authenticate part only?

    • @BoualiAli
      @BoualiAli  10 месяцев назад +1

      You can implement caching

    • @samymohsen505
      @samymohsen505 10 месяцев назад

      can you please recommend me a good way for In memory caching? or any other way that make me avoid using things like Redis aka other database with its own server?@@BoualiAli

  • @laylaelaam9507
    @laylaelaam9507 4 месяца назад

    thank uuuu so much !!!

  • @eugenheise846
    @eugenheise846 Год назад +2

    Hi Ali, if possible, could you show the imports of the class briefly after you finish with a class, for comparison next time? Thank you!

    • @BoualiAli
      @BoualiAli  Год назад +1

      Check the code on Github

  • @akadeadahot7067
    @akadeadahot7067 6 месяцев назад

    Hello sir i saw video tutorial n these are awesome like each n every topic will convered in videos. One request from my side for desktop native application using electron js with angular in details project like books library project i possible please consider it in your upcoming playlist because no one is on you tube who is doing electron js tutorial.

    • @BoualiAli
      @BoualiAli  6 месяцев назад

      I will try my best

  • @vijayank923
    @vijayank923 Год назад

    Awesome, I love your explanation. Can you make video on Spring boot 3.0 - Webflux with JWT Token

    • @BoualiAli
      @BoualiAli  Год назад

      I will take note of that.
      I’m preparing a new video that you’re gonna love absolutely

    • @vijayank923
      @vijayank923 Год назад

      @@BoualiAli I’m waiting

  • @LIBGHIT
    @LIBGHIT Год назад +1

    that is the best vedio about jwt implementation so far, thank you for your simple explanation that even a new user of the spring framework could understand clearly.
    i have a question please if you don t mind, I'm using spring mvc with thymeleaf, i don t know how to send the jwt token in the header with thymeleaf like in your case with postman you sent it in the authorization type bearer token, and there is no one talking about it
    thank you

    • @adrianfee9131
      @adrianfee9131 Год назад

      I am also trying to figure this out

    • @LIBGHIT
      @LIBGHIT Год назад

      @@adrianfee9131 i manage to do it using session like instead of retrunin the jwt token to the user and send it from the header you can just save it into the session than in the dofliter function you take the jwt token and validate it from the session i ll join the code below i hope this helps

    • @LIBGHIT
      @LIBGHIT Год назад

      i don t know if it s the right way to do it but it is working

  • @muniapriyansu8805
    @muniapriyansu8805 Год назад

    I was struggling to learn this, thank you so much for this video. It helped a lot

    • @BoualiAli
      @BoualiAli  Год назад

      I’m happy to help

    • @muniapriyansu8805
      @muniapriyansu8805 Год назад

      @@BoualiAli what changes to make in order to specifically allow USERS to one endpoint? .hasRole("USER") doesnt work SecurityConfiguration

    • @BoualiAli
      @BoualiAli  Год назад +1

      @@muniapriyansu8805 you need to add the annotation @enableglobalsecuritymethod on the security config class and the @preuathorize will work like a charm
      I have another spring security in the same playlist that explains authorization and how it works

  • @alexakos1992
    @alexakos1992 5 месяцев назад

    Thank you very much for the content! Can you write for us the non depricated solution for setSigningKey() and parseClaimsJws()?

    • @BoualiAli
      @BoualiAli  5 месяцев назад

      Yes, check the playlist and the videos and order by publish date

  • @Zentex2307
    @Zentex2307 Год назад

    Hi! Great Tutorial! One of the best I ever seen. I have only one problem, I can still add more users with the same email. You don't check this in tutorial too.

    • @BoualiAli
      @BoualiAli  Год назад +1

      Thanks for the comment.
      Yes duplicated users are not prevented. Add @Column(unique=true) on the email field and it will fix it

  • @_U_will_always_shine
    @_U_will_always_shine Год назад

    Randomly found this channel. Wonderfully explained. Thanks a lot. Just a request, could you paste that key generator url in the description?

    • @BoualiAli
      @BoualiAli  Год назад

      You can check the code in my github account (link in the description)

  • @emometalpunk
    @emometalpunk Год назад

    Thank you for your awesome tutorial! I learn a lot from your video. Let's say if we had multiple microservices and Spring Cloud Gateway routing to process requests to those (downstream) services. I was wondering if you could let me know how we can apply the jwt from your video (user microservice) to other microservices as a global one.
    Thank you once again for your time and consideration!

    • @BoualiAli
      @BoualiAli  Год назад +1

      It works the same way.
      Just implement it on the api gateway level

    • @BoualiAli
      @BoualiAli  Год назад +1

      Really happy to have you here

  • @husseinali1199
    @husseinali1199 Год назад

    thank you for your tutorial i hope you do tutoril for spring boot microsrvice securty JWT

    • @BoualiAli
      @BoualiAli  Год назад

      I’m preparing something already

  • @vageeshanvageesh5583
    @vageeshanvageesh5583 Год назад +2

    Great content, thank you. can you please provide a tutorial in Oauth2 implementation in spring boot 3 (Authorisation server + Resource server) using JWT?

  • @jasonadventure2265
    @jasonadventure2265 Год назад

    It's very clear logic, thanks a lot Bouali

  • @baptisteprieur232
    @baptisteprieur232 Год назад

    Thank you for your great explanation. I watched this video many times, it 's very clear. Can we have the sources of your project ?

    • @BoualiAli
      @BoualiAli  Год назад

      Hello,
      The repo is in the description of the video

  • @yassine7619
    @yassine7619 Год назад

    thank you for the video. Do you have a video about CSRF ?

    • @BoualiAli
      @BoualiAli  Год назад +1

      I will take note of that and make one soon enough

  • @lakshmanveerababu4195
    @lakshmanveerababu4195 Месяц назад

    Hi sir, Can you make a video how to handle the exceptions of Json web token, as the @RestControllerAdvice approach is not working for handling the Jwt exceptions.

  • @BoualiAli
    @BoualiAli  Год назад

    COUPON Code: *EARLYBIRD20* => Spring Data J PA course: aliboucoding.com/p/the-full-guide-to-master-spring-boot-data-jpa

  • @Hundinui
    @Hundinui Год назад +1

    Hi and thank you for the amazing content. I was wondering, if you need to initialize your admin with first name, last name, email and password in the project settings, how would you do it in this case? It looks like that you can only register it through the registration form, but I need to set one and the only admin in the project configuration settings. Thanks!

    • @BoualiAli
      @BoualiAli  Год назад +1

      You can use a database migration like Flyway
      I already posted a video how to do so.

    • @Hundinui
      @Hundinui Год назад

      @@BoualiAli, Thanks!

  • @manospat1066
    @manospat1066 5 месяцев назад

    Great! One question, you take the jwt of the authenticate(log-in) to send the Demo Controller request. If I use jwt I got from Register, it is the same ? In simple words, if I want log-in directly after the register (and not log in again), is there any extra step I need to do? (for example set SecurityContextHolder). I guess both in log-in and Register the SecurityContextHolder must be set ! Thanks !

  • @abdelkaderkaouane1944
    @abdelkaderkaouane1944 Год назад

    Hi.
    I have two questions, if you like to help me.
    1. Why do you save tokens in the database?
    2. What is the difference between access token and refresh token.
    Thank you.

    • @BoualiAli
      @BoualiAli  Год назад +1

      Finish watch the next two videos (logout and refresh token) and you will get it

  • @carlosjesusbarreraaleman-sl2xd
    @carlosjesusbarreraaleman-sl2xd 2 месяца назад

    Friend, a question, I see that many people in other videos create the UserDetails within the entity that they call, for example, user, but others create the entity and create another class called UserDetails to implement the methods, but in your case you overwrite the UserDetails in your UserDetailsService class. My question is, what would be the most ideal way to do this?

  • @salaheddinekadada9603
    @salaheddinekadada9603 Год назад

    Thank you very much for the tutorial , could you provide us how implement login with social media and jwt

    • @BoualiAli
      @BoualiAli  Год назад

      I’m worrking on such tutorial

  • @ysacpebes1462
    @ysacpebes1462 Год назад

    Hello friend, how are you, thank you very much in advance for the video... I would like to ask you a question... how can I add ADDITIONAL INFORMATION TO THE TOKEN? thank you so much. c:

    • @BoualiAli
      @BoualiAli  Год назад +1

      I already mentioned that.
      Use the claims

  • @shukrullohakimjanov7561
    @shukrullohakimjanov7561 8 месяцев назад

    Thank you so much I always use your method for secure but I have question Can I use
    this codes in big project

    • @BoualiAli
      @BoualiAli  7 месяцев назад

      better use keyclaok.
      the video is coming next week