Spring Boot + Spring Security with JPA authentication and MySQL from scratch - Java Brains

Sdílet
Vložit
  • čas přidán 7. 06. 2024
  • Let’s setup a brand new Spring Boot project from scratch with Spring Security that works with database authentication using JPA and connects to a MySQL database. I’ll walk you step-by-step through how to get Spring Security to connect to the MySQL instance using JPA and authenticate users against the user information stored in the database.
    Code: github.com/koushikkothagal/sp...
    Java Brains website: javabrains.io
    #JavaBrains #BrainBytes #HowTo #SpringSecurity #Spring #SpringBoot #Java #Tutorial

Komentáře • 456

  • @Sausty
    @Sausty Před 3 lety +37

    Fantastic tutorial, probably the clearest tutorial I've ever watched on a pretty complicated subject. Thank you very much!

  • @sarthakgupta290
    @sarthakgupta290 Před rokem +11

    Your way of explaining complicated concepts in a simple manner is outstanding! Thank you so much!

  • @Sebriniel
    @Sebriniel Před 3 lety +3

    I've been struggling with Spring Security for days. Your tutorial made me able to install an authentication system on my app in two hours. THANKS!

  • @manojkanna222
    @manojkanna222 Před 2 lety +4

    I saw the whole spring security basic videos, everything till now was explained well. anyone can easily understand these spring security topics. Thank you for your time and effect

  • @brhaneweldeslase1289
    @brhaneweldeslase1289 Před 4 lety +4

    I am big fun of your teaching. I don't even want to go for other resources unless I don't find in Java Brains.
    I really appreciate your contribution to my life. You are such important to me."live long and God bless you."

  • @HanilKathuria
    @HanilKathuria Před 4 lety +14

    Sir, you have made Spring Security so easy to understand. Thank you so much for your efforts😀

  • @damianw345
    @damianw345 Před 4 lety +23

    wow, these are the best tutorials on Spring Security I have ever found on the Internet. Please keep up the good job :)

  • @kuljeetkumar4657
    @kuljeetkumar4657 Před 4 lety +30

    This is what is required on CZcams. Kudos sir
    Bring full stack courses also. I bet 1 million is not far away then.🙌

  • @tsegaighebremedhin5536
    @tsegaighebremedhin5536 Před 4 lety +19

    Great Job Koushik!!! I like your teaching style and JavaBrains has been my main source of learning SpringBoot and java related stuff lately!!

  • @haimmichalashvili8251
    @haimmichalashvili8251 Před 3 lety +43

    Highly important guys.. at @01:14
    be aware, the role field must be save with "ROLE_" prefix in the DB, (dont know the reason). I wasted alot of time because I entered the authorization role mapping value which is without the "ROLE_" prefix.
    thank for the tutorial sir, BIG LIKE!

    • @hemantjain8777
      @hemantjain8777 Před 3 lety +2

      @Haim you are a life-saver. Spent like 1 hour to find out what was wrong.

    • @alessandrosantana9606
      @alessandrosantana9606 Před rokem +1

      BIG THANKS MY MAN!

    • @swathikota
      @swathikota Před rokem +2

      The hasRole and hasAnyRole methods used for authorizing requests accept parameters starting with "ROLE_". If you look at the java description for these methods, the parameters that are passed will be automatically appended with ROLE_ in the beginning. So definitely your database needs to have data starting with ROLE_ corresponding to role field or wherever you hard-code the authority value. This is my understanding.

  • @bibekdas3592
    @bibekdas3592 Před 3 lety +2

    You are doing a great service by sharing all these...no praise will ever be enough..👍👍👍

  • @TomosLeggett
    @TomosLeggett Před rokem

    I've watched almost every single video I could find on this subject and this was the clearest and most helpful and actually worked.
    Thank you for your help!

  • @mohitpatidar8880
    @mohitpatidar8880 Před 3 lety +2

    You are doing fabulous work Sir...( Y) Hats off to you for giving so much content to the community for free.

  • @divtosz
    @divtosz Před 4 lety +2

    Thank you so much! You explain so clearly, much better than all the paid courses online! 😄

  • @Mohamed-uf5jh
    @Mohamed-uf5jh Před 4 lety +1

    Thanks sir, these are the best tutorials on Spring Security I have seen
    on the Internet

  • @Torayasu
    @Torayasu Před 2 lety

    Clear and simple, managed to implement my own JPA authorization provider thanks to this video. Great Job !

  • @AnantaAkash.Podder
    @AnantaAkash.Podder Před 5 měsíci

    By Far the Best Explanation of Spring Data JPA with Spring Security...got many concept cleared out of this Tutorial

  • @vurihur4533
    @vurihur4533 Před 2 lety

    SIR the whole day I've been trying to get this to work... then 10 minutes in this video and it works now. I really thank you a lot!!!

  • @monishad7040
    @monishad7040 Před 3 měsíci

    Clearest tutorial with minimum time. Easy to understand. Thank you for wonderful lectures sir.

  • @deeptiadmile9986
    @deeptiadmile9986 Před 4 lety +5

    This security series is absolutely amazing !! All aspects for each type covered.. 😀👍

  • @bendego2800
    @bendego2800 Před 3 lety

    Thanks for coming back !!

  • @RDSRao
    @RDSRao Před 4 lety

    Thank you once again, Kaushik for your time and teaching!

  • @liferayasif9382
    @liferayasif9382 Před 4 lety

    Thank you so much, its always pleasant to watch your videos, crystal clear, in details and precise to point. Thank you so much for your tutorial.

  • @sheelstera
    @sheelstera Před 4 lety +11

    Great start to the weekend.. God bless.. Please cover JWT, OAuth and SAML

  • @igorgvozdic2769
    @igorgvozdic2769 Před 4 lety

    I have watched a ton of similar videos, but your videos are best by far!

  • @DrunkenEngineer
    @DrunkenEngineer Před 4 lety +1

    Thank you for uploading such video's.
    Really helps a lot in Interviews.

  • @Runa_Nura
    @Runa_Nura Před 4 lety

    The best video for Security. easy to understand and all codes works fine.
    Plz Mr make more videos for spring.

  • @thornton
    @thornton Před 3 lety +6

    Thank you so much! This unblocked me on a problem I was having with my Repository.

  • @orhanyarar7552
    @orhanyarar7552 Před 3 lety

    thank you very much for putting this together. Your explanations are very clear, concise and to the point!

  • @akhilsamineni4628
    @akhilsamineni4628 Před 4 lety +1

    Really AWESOME!! One of the best videos I watched.

  • @shivaakrish
    @shivaakrish Před 2 lety

    This is one of the best tutorial i have seen in my entire life :D Thank you so much.

  • @midhunma8875
    @midhunma8875 Před 22 dny

    Thanks, this is the clearest from scratch video i found so far..so difficult to explain yet you made it look easy

  • @abukasozi295
    @abukasozi295 Před 4 lety +2

    This is pure awesomeness thankyou very much. Amazing!!!!

  • @GreatAnubis
    @GreatAnubis Před rokem

    I've been looking for such tutorial. Great video. Thank you!

  • @abhisheksengupta4159
    @abhisheksengupta4159 Před 4 lety

    Best video on spring security !! Thanks Kaushik :)

  • @dhananitejendra3151
    @dhananitejendra3151 Před 6 měsíci

    By far the best tutorials on spring security. Thanks a lot

  • @mlprasad79
    @mlprasad79 Před 4 lety +3

    This is good stuff ! Now my weekend is productive as I learned something new from this ! Long live KK !

  • @yazidelhachimi1628
    @yazidelhachimi1628 Před 2 lety

    The best tutorial i've seen on youtube !! Thanks man !

  • @nitiKT
    @nitiKT Před rokem

    Sir, hatsoff to you.. you made learning spring security enjoyable for me.. being dyslexic I hated spring security..

  • @johngalarza-calderon4801
    @johngalarza-calderon4801 Před 3 lety +3

    This was amazing. So well planned and executed and explained wonderfully. You helped me grasp this which I was struggling with based on online text based tutorials that I had found. I will definitely be sending anyone I know trying to learn this as well here!

  • @dinunclv
    @dinunclv Před 4 měsíci

    really good series of tutorials. Great Job! Since spring 6 some things have slightly changed, but you explain the core principles very well. Thanks!

  • @priyankjoshi3018
    @priyankjoshi3018 Před 2 lety +2

    Nice One Koushik, keep the good work up. With addition to all the information, would like to add, spring by default adds "ROLE_" to whatever the role we are trying to check for the user. Thats why Kaushik has inserted ROLE_USER in the roles column of the user table. Now why we are trying to access different urls, spring check the role using the class ExpressionUrlAuthorizationConfigurer which get called from the overriden method configured having HttpSecurity as parameter. Check the implementation for the method hasRole in the method chaining.

  • @AshenafiMaru-ul3rg
    @AshenafiMaru-ul3rg Před rokem

    I never knew . . . Spring Boot Security is this easy . . . thanks to you brother!

  • @rupeshsharma2453
    @rupeshsharma2453 Před 3 lety

    A very informative video on spring security. Thanks a lot. Cheers

  • @AdrianVrabie
    @AdrianVrabie Před 4 lety +1

    Indeed, very well explained! I loved it! Subscribed + Shared!

  • @ivanetinajero
    @ivanetinajero Před 4 lety +1

    Great Video. God bless you. Regards from Mexico!

  • @SrivatsaLakshmi
    @SrivatsaLakshmi Před 3 lety

    Fantastic tutorial. Well explained and easy to follow along.

  • @drawlzlolwlz5953
    @drawlzlolwlz5953 Před 3 lety +1

    Finished the tutorial! great job and explanation

  • @backtoGodhead0
    @backtoGodhead0 Před 3 lety

    Excellent, Thank you Kaushik, May God bless you!

  • @dimimurik3970
    @dimimurik3970 Před 3 lety

    Very good tutorial, nice and clear explanations. Thanx a LOT!!

  • @SushilKumarBhaskar
    @SushilKumarBhaskar Před 4 lety +3

    Yes Correct, read query many times for authentication/authorization, we might consider using LDAP. LDAP has fast read query.

    • @Java.Brains
      @Java.Brains  Před 4 lety +2

      Well, authentication happens only once per session. Also, JPA could be supported by a caching mechanism so that an entity is not looked up more than once.

  • @firozgg7524
    @firozgg7524 Před 4 lety +2

    Tjank you so much brother... It was the best spring security tutorial i've ever watched so far...💜

  • @francogb
    @francogb Před 4 lety +76

    Epic! Thank you!
    Please talk about integration with JWT

    • @SushilKumarBhaskar
      @SushilKumarBhaskar Před 4 lety +1

      yes, eager to watch that integration with JWT,

    • @sujithg5873
      @sujithg5873 Před 4 lety

      Yess JWT 🙄🙄🙄🙄🙄

    • @reluscarlat7140
      @reluscarlat7140 Před 4 lety +5

      You can find well explained implementations of spring security with JWT in Laurentiu Spilca's spring security playlist:
      czcams.com/video/zA3uxv8RMF0/video.html
      There is pure gold information that really helped me to understand the basics of security for monolith applications and microservices applications.
      Hope it will help you! :)

  • @samedsakhri5117
    @samedsakhri5117 Před 4 lety +1

    Best I've ever seen on youtube .. thks man 😀👍

  • @selvakumarm8948
    @selvakumarm8948 Před 4 lety

    Sir, Thanks for you effort to provide us great quality content. I really like your video style. :)

  • @ArvindYadav-cn4md
    @ArvindYadav-cn4md Před 4 lety

    Great job Sir. This is what required.. thank you v much.

  • @ankitank1990
    @ankitank1990 Před 3 lety

    Thanks for your hard effort to make the things done. Awesome

  • @francescodigiuseppe73
    @francescodigiuseppe73 Před 3 lety

    Thanks a lot Prof, you're my best teacher

  • @vasileiosstamos5940
    @vasileiosstamos5940 Před 4 lety

    Spring Security + JWT Authentication would be superb!

  • @Chanakya0000
    @Chanakya0000 Před 2 lety

    You made it look so easy. Thank you.

  • @ChathushkaPeiris
    @ChathushkaPeiris Před 2 lety

    this is exactly i was looking for! thanks!

  • @anaghavarhade7375
    @anaghavarhade7375 Před 3 lety

    Thank you so much for these videos. They are very helpful ❤❤❤

  • @arungore6578
    @arungore6578 Před 4 lety +2

    Early morning .. good start

  • @ashokmandadi
    @ashokmandadi Před 4 lety

    very good video bout spring security, usage of lamda expression also very nice

  • @awadijohan
    @awadijohan Před 2 měsíci

    really I'm so lucky to find your video that helped me well to understand and learn with simple method the authentication with spring security, really I appreciate your qualified explanation.
    big thanks from bottom of my heart ♥

  • @priscillavannyamelia8736

    Amazing tutorial, thank you for creating this video

  • @prageethjayasinghe709
    @prageethjayasinghe709 Před 3 lety

    Perfect teaching skills.

  • @muditshukla
    @muditshukla Před 4 lety

    Great tutorial Sir. Hats Off.

  • @sandeepmreddy2788
    @sandeepmreddy2788 Před 3 lety

    Great effort, great explanation.. Thank you...!

  • @nageshmath9376
    @nageshmath9376 Před 4 lety

    Art of coding ,simple and quick

  • @goonerritz93
    @goonerritz93 Před 3 lety

    Great tutorial! Thank you!

  • @sugoi5240
    @sugoi5240 Před 5 měsíci

    your explanation is so good i wanna cry

  • @ilyesdjerroud7003
    @ilyesdjerroud7003 Před 4 lety

    Hello , thank you so much for your work ! We ARE waiting for LDAP lessons please :) !

  • @beginner-techies6793
    @beginner-techies6793 Před 4 lety

    wow , amazing explanation, waiting your video on spring boot with keycloak

  • @arashaadd
    @arashaadd Před 2 lety

    this man is the greatest of all time!!!

  • @buckg2129
    @buckg2129 Před 4 lety

    Incredibly helpful!

  • @user-rh7fg5gn4b
    @user-rh7fg5gn4b Před 4 lety +1

    very good tutorial Dear MAN!

  • @macmuffin1865
    @macmuffin1865 Před 3 lety

    Great tutorial. very clear!

  • @daniellaerachannel
    @daniellaerachannel Před 4 lety

    more and more and more and more spring please!!!!! thanks a lot

  • @hyperborean72
    @hyperborean72 Před 2 lety

    thank you so much for the amazing tutorial

  • @deepakkakkar7698
    @deepakkakkar7698 Před 2 měsíci

    Awesome explanation man,

  • @KalizVids
    @KalizVids Před 2 lety

    Perfect tutorial, thanks so much

  • @codegeek8256
    @codegeek8256 Před 4 lety

    Thank You so much Koushik

  • @FranklinXPe
    @FranklinXPe Před 4 lety +1

    Congratulations #JavaBrains. It's the best tutorial I've read about Spring Security + JPA. It's almost complete. Thanks you very much!
    Pd: I think you should endcoder your password with other tecnique, because it inserts plain-text password.

    • @Java.Brains
      @Java.Brains  Před 4 lety +3

      Yes, I do mention that use no-op encoding for simplicity. check out the password encoding tutorial on my channel to learn about password encoding!

  • @ayaagourram7363
    @ayaagourram7363 Před 3 lety

    Great job ! Thank you Sir !

  • @nithinvarghese7765
    @nithinvarghese7765 Před 4 lety

    great tutorial..and happy Onam🙂

  • @ayzaz_m6289
    @ayzaz_m6289 Před 4 lety +1

    Thank you so much Sir !!!

  • @krishnakishore3258
    @krishnakishore3258 Před 4 lety

    Thanks a lot for this excellent content.

  • @thilinad.gunasekara7281

    It's helped me so much. Thanks.

  • @saivamsikrishnakataru4583

    Thank you very much sir
    It worked very well

  • @jeeperscreepers7
    @jeeperscreepers7 Před 3 lety

    Love the video! thank you!

  • @krishmetalhead
    @krishmetalhead Před 4 lety

    Such a good video. Very Nice .

  • @himanshusinghcoolboy
    @himanshusinghcoolboy Před 4 lety

    very good and useful stuff, Please make some series about reactive programming with spring.

  • @tedodjukic4789
    @tedodjukic4789 Před 3 lety

    very good explained!

  • @umaveerarajulapati3722

    Nice Explanation 👌👌

  • @stone8905
    @stone8905 Před 3 lety

    My respect sir. Thank you very much

  • @pratik037
    @pratik037 Před 4 lety +1

    Hello, first of all, great tutorial.
    Just needed help with a small doubt. Can you show how did you make the active column in the table empty(valueless) and still not displaying null in the CLI? Thanks.

  • @1swine144
    @1swine144 Před 4 lety

    great tutorial, thanks

  • @SushilKumarBhaskar
    @SushilKumarBhaskar Před 4 lety +29

    Please🙏 upload LDAP supported Spring security ... Eager to watch

    • @s3649
      @s3649 Před 3 lety

      czcams.com/video/-wDUChgvYgU/video.html

  • @souvikdasgupta8960
    @souvikdasgupta8960 Před 4 lety +2

    Very nicely explained.
    Can you make a tutorial on Spring security + oauth2