Spring Boot 3 Security Tutorial | Authentication and Authorization | Spring Security Tutorial

  Рет қаралды 43,765

Genuine Coder

Genuine Coder

Күн бұрын

Пікірлер: 135
@GenuineCoder
@GenuineCoder 5 ай бұрын
Part 2 - JWT Authentication with Spring Security: kzbin.info/www/bejne/foqlg3Whjtmjm9E More in-depth Spring Boot courses on the playlist: kzbin.info/aero/PLhs1urmduZ2-W9wfEktEnSYJWrdoLUdOk
@RK22082
@RK22082 4 ай бұрын
40:30 To Rename any file from the Intellij Idea, Right Click -> Refactor -> Rename 😊😊😊 @GenuineCoder ❤❤❤
@mekanikoosiraniko3172
@mekanikoosiraniko3172 2 ай бұрын
I struggled for 2 weeks on how to use db users for authentication using spring security until I found your video. Kudos to you. The world needs a lot of people like you.
@indiancitizen6609
@indiancitizen6609 4 ай бұрын
To all who are searching for building a login system using spring security, this is best one I have found. Perfect in all sense. THanks bro. Please do build more videos. You are doing a great job.
@_naushad_ahmad
@_naushad_ahmad 4 ай бұрын
Hey Bro. Have you implemented the code . When i login the page i got bad credentials.
@indiancitizen6609
@indiancitizen6609 4 ай бұрын
Either your username or password might be wrong
@rxmanx
@rxmanx 15 күн бұрын
Best updated and clear to the point on KZbin. I watched at 2x and finally was at normal speed.
@creumakuzola4227
@creumakuzola4227 26 күн бұрын
Excellent course. Thank you so much sir!
@aknowledgemachine
@aknowledgemachine Ай бұрын
I love it :) The way how he explained about security is much much better than any other instructor. Thank you
@shamimahamed8333
@shamimahamed8333 4 ай бұрын
I have been watching spring security videos for many days, they delivered lecture over 1-2 hours, but your lecture is so clear and easy to understand over this difficult topic, thank you so much sir, for your contribution.
@أحمدمحمودعبدالعال-ر8ق
@أحمدمحمودعبدالعال-ر8ق Ай бұрын
I'm from Egypt, I want to say for you thanks for this video, actually I understand everything about spring security.
@briangicharu2899
@briangicharu2899 5 ай бұрын
This is the best tutorial on Spring auth in KZbin so far. Thank you very much. I mean its the best. I had to subscribe for more
@patrickfriedsei7800
@patrickfriedsei7800 Ай бұрын
extremly good tutorial. Top 👍🏻
@ajitsuryawanshi8809
@ajitsuryawanshi8809 5 ай бұрын
perfect video i am searching for , i really enjoyed it keep uploading like....
@UdegbunamBenjamin
@UdegbunamBenjamin 5 ай бұрын
You are truly a genuine coder, the video is so precise, i highly recommend this tutorial.
@antonellopierri961
@antonellopierri961 7 ай бұрын
Extremely interesting tutorial. The comparison between hashing methods was also very helpful. Thank you for sharing this content.
@maheshrao-hy8bp
@maheshrao-hy8bp 12 күн бұрын
Excellent explanation
@UCSBMNaveenkumar
@UCSBMNaveenkumar 4 ай бұрын
i was try lot of attempt to learn this concept but i con not learned.thanky to your video.🙂
@KirillMvS
@KirillMvS 2 ай бұрын
Thank you for the video, it is really good as Spring Security in action:) I would appreciate the same video for other relativaly difficult topics for beginners. Subscribed.
@pravinjagtap8467
@pravinjagtap8467 4 ай бұрын
Great content explained with good pace, it gives time frame to understand new learner. Great Job!!
@khanhpd3129
@khanhpd3129 6 ай бұрын
Thanks for very helpful article. I research and practice for many article then realize it’s security spring 2. Thanks for ur security spring 3 one more time. Now i can move on another section 🎉 u explain very detail, hope i can see u in another video
@ТимурЖуматаев-у3д
@ТимурЖуматаев-у3д 4 ай бұрын
The best tutorial about Spring I've ever seen, thanks
@cheeks_of_the_boreal_valley
@cheeks_of_the_boreal_valley 3 ай бұрын
very comprehensive, easy to understand tutorial. Thank you very much
@cozitsyash1301
@cozitsyash1301 3 ай бұрын
Great content Sir plz dont stop making such videos Too good thank you !!
@Donydavid
@Donydavid 6 ай бұрын
this is good way of teaching with such relaxed explanation . A billion thanks to the tutor i have been using old version of spring security i got confused to align with these new changes. kindly do more videos on spingboot and microservices. as continuation for this can you make a video on jwt and oauth2
@GenuineCoder
@GenuineCoder 5 ай бұрын
Thanks. A new tutorial for microservices with real-world video streaming project is now available kzbin.info/www/bejne/g6O2dnaaiK6Uhck
@liqwis9598
@liqwis9598 2 ай бұрын
Nice explanation bro , Can you please teach us with OKTA ? as well
@MohaideenA
@MohaideenA 7 ай бұрын
Malayali bro :) . I love your slang .❤. from TN
@bejkon116
@bejkon116 2 ай бұрын
Very nice tutorial, thank you for this.
@UninspiredFilm5
@UninspiredFilm5 Ай бұрын
Fantastic video, thank you so much!
@John-hi8rd
@John-hi8rd 2 ай бұрын
Thank you for the good video. Can you also make a video to enhance your project to add the csrf protection for the system?
@AVRNWITHVLOG
@AVRNWITHVLOG 2 ай бұрын
love u sir its very helpfull and explaination is very simple
@callmebean1345
@callmebean1345 4 ай бұрын
Woa, this tutorial is very good. I really recommend this
@nahomdiro7818
@nahomdiro7818 5 ай бұрын
Thank you. very clear I highly recommend this tutorial
@cozitsyash1301
@cozitsyash1301 3 ай бұрын
Sir please bring more Spring Boot tutorials and its important topics
@ErnestoPrime
@ErnestoPrime Ай бұрын
Great Content, thanks for your videos
@МиколаХлопик
@МиколаХлопик 4 ай бұрын
Thank you very much. But in my case I faced the problem of incorrect redirection after click 'Log in ' button'(nothing happened). I solved it by replacing th:action in custom_login.html to . I use 3.2.5 version of springboot.
@mehrshin.canada
@mehrshin.canada 5 ай бұрын
perfect tutorial, I enjoyed watching.
@Yahayel
@Yahayel 5 ай бұрын
Perfect people not exists ! Mr.GC : Are you sure ? thank you sir for this content !!
@aimerninelie2582
@aimerninelie2582 4 ай бұрын
Thank you very much, it is really helpful
@BizzaroBrainBoi
@BizzaroBrainBoi 6 ай бұрын
best ive ever seen. thank you so much.
@mekanikoosiraniko3172
@mekanikoosiraniko3172 2 ай бұрын
Hi Guru, can you please give me an instruction on what to add to the codes you created to pass username to the pages that would be accessed by the login user, this would be needed to record created by and modified by . thank you so much again.
@ruwanliyanage228
@ruwanliyanage228 5 күн бұрын
Thanks very much 🙂🙂
@geordymontenegro6523
@geordymontenegro6523 5 ай бұрын
NICE VIDEO PERFECT, THANKS FROM COLOMBIA
@viktors.4844
@viktors.4844 4 ай бұрын
Thank you for great video and very good explanation! Can I may one questions? Why we have two instances/beans (lines 32, 69) of one classes MyUserDetailService ?
@panchinrc1993
@panchinrc1993 3 ай бұрын
Great video , so simple to understand, thank you! Greetings from Argentina! PD: There is an extension to see colored console messages? Mine it's plain white, thanks!
@snakefoxxofekans
@snakefoxxofekans 4 ай бұрын
amazing video. Thank you!
@lamlocbui2247
@lamlocbui2247 Ай бұрын
why .csrf(AbstractHttpConfigurer::disable) still not work with me? :< I have done all step on video
@SalgadoMaffini
@SalgadoMaffini 4 ай бұрын
This was a great help, i was trying to make a register page and it worked; tho i'm having some difficulty trying to give MyUser more attributes, everytime i give them a birth date or an email i can't register them anymore on the DB. I think it has something to do with the UserDetails but don't know how to proceed.
@GenuineCoder
@GenuineCoder 3 ай бұрын
What's the error you are getting? Any error messages?
@anirangs
@anirangs Ай бұрын
Thank you for this video. Quick question though.. When I follow your tutorial for "Redirect to a specific page after successful login" I notice that I have to enter the credentials twice before i get directed to the target page. The first time goes back to the login page itself after a successful authentication
@samahmahdi5511
@samahmahdi5511 4 ай бұрын
Good explanation. Thanks
@johncarter2338
@johncarter2338 2 ай бұрын
Hi, It's a great video. I am facing a slight problem. My Authentication Success Handler part is not working properly. I have checked the codes but there isn't problem. Is there anything I can do solve this ?
@aitorzatica4291
@aitorzatica4291 2 ай бұрын
What's the difference with using OAuth2, and when do we have to use each of them?
@blaisemugisha8990
@blaisemugisha8990 25 күн бұрын
why does my setDefaultTargetUrl() not work well? i dont get redirected
@sriraml464
@sriraml464 Ай бұрын
good one , great video
@marvenmalope9504
@marvenmalope9504 4 ай бұрын
Thank you very much sir👏
@wilsonvaboum1338
@wilsonvaboum1338 3 ай бұрын
Bravo !!! full explantion
@lorenzo.
@lorenzo. 4 ай бұрын
Great tutorial! Clear, chill and great overall tutorial! But I just had a question, how would I go about retrieving the user id?
@GenuineCoder
@GenuineCoder 4 ай бұрын
Thanks! I believe you want to get all the users and their IDs. This can be done by creating a new GET endpoint. For example, at 31:38, you can - Create a new GetMapping("/register/get-registered-users") function. - Use myUserRepository.findAll() to get all the registered users. - Take the username and their ID and return it as the endpoint response.
@lorenzo.
@lorenzo. 4 ай бұрын
@@GenuineCoder Ahh that's what I thought matching the username in the db. Is there no other way of doing this in a controller? Using Principal or something along those lines?
@GenuineCoder
@GenuineCoder 4 ай бұрын
@@lorenzo. I understand your question better now. You want to find the current already logged-in user while accessing an endpoint, right? There are multiple ways to do this. For example, on every endpoint function, you can inject a Principal object and get the username from it. @GetMapping(value = "/user/get-logged-in-user") public String getUsername(Principal principal) { return principal.getName(); } Here's a tutorial for this www.baeldung.com/get-user-in-spring-security
@rahul-java-dev
@rahul-java-dev 3 ай бұрын
Thank you so much for the tutorial, I was able to verify credentials from Db, This is the very first time I was able to do it. But one thing, error pages are being shown--- like 403 or 404.htmls, what could be the reason? I am seeing only the default pages provided by Spring.
@hakangleissman
@hakangleissman 4 ай бұрын
Great stuff!
@karthi1610
@karthi1610 Ай бұрын
Adipoli video❤
@mekanikoosiraniko3172
@mekanikoosiraniko3172 2 ай бұрын
Hi Sir, Thanks for the video, how can you get the username to the landing page after sucessful login? Thanks.
@peshutanpavri1599
@peshutanpavri1599 6 ай бұрын
This is an excellent video, and it was a very good revision for me as I have not used this for a while. I have two questions if I may please: 1) when using Spring Boot as a Rest API, when I am only returning JSON, and i have a seperate front-end, I was having issues with filters, and I had to implement my own authentication end point in a controller, is this normal ? How to use filters with REST API? 2) Is it possible to use HandlerInterceptor instead of filters ? OMG, at 47:38, look at the names of those classes, no wonder so many people are turned off by Java code, I love Java, but these names are awful
@GenuineCoder
@GenuineCoder 6 ай бұрын
1. Using filters to do manual authentication (using credentials as request parameters OR request headers) is possible. But, it is not recommended. Because, login session management (allowing subsequent requests after login) becomes hard. Also, this is not safe as per industry standards. Better will be to do it via username-password authentication using Spring security or use OAuth and JWT tokens. 2). You can use HandlerInterceptor for this requirement. The difference is, filters work at the servlet level and HandlerInterceptor work at the Spring MVC level. So, HandleInterceptor can handle spring context as well. Here is a good comparison stackoverflow.com/a/71227949/4889711
@peshutanpavri1599
@peshutanpavri1599 6 ай бұрын
Thank you very much@@GenuineCoder
@JAYSONLEVINTAPIA
@JAYSONLEVINTAPIA Ай бұрын
Good day sir, what dependencies did you use to?
@jyothig357
@jyothig357 6 ай бұрын
Hi Sir, I am getting "please sign in" error when i do user registration using postman and as csrf is also disabled. Please suggest any other changes i need to do with spring security 6
@mukhitesenin6376
@mukhitesenin6376 6 ай бұрын
you are a genuine coder fr)
@hiephoang7323
@hiephoang7323 4 ай бұрын
the great tutorial !
@gajanankanekar9118
@gajanankanekar9118 6 ай бұрын
timestamp 11.30. Sir, username, password, role all these details are available in the data table. How can we hardcode these details?
@gajanankanekar9118
@gajanankanekar9118 6 ай бұрын
TimeStamp 12.19 Sir, UserdetailsService bean showing error asking to add return statement
@la-dev
@la-dev Ай бұрын
I see that you almost used @Autowired everywhere. Is it according to the best practices or it really doesn't matter and Spring can handle it easily whatever way we inject the dependency?
@GenuineCoder
@GenuineCoder Ай бұрын
Yes, it is totally fine to use decency injection as much as you need. I have worked on production applications that had thousands of such dependencies (beans) injected across the code. Spring is pretty good at handling it.
@GenuineCoder
@GenuineCoder Ай бұрын
By default, all beans have a singleton scope and are shared across the whole app. So no matter how many times you inject/use it, only one object will be created in the memory. There is a prototype scope to have multiple instances injected as well. Regardless of which bean scope you use, the decency injection will be efficiently managed by the spring framework. www.geeksforgeeks.org/singleton-and-prototype-bean-scopes-in-java-spring/
@la-dev
@la-dev Ай бұрын
​@@GenuineCoder I hope you were understand what I meant from the @Autowired. That is basically to refer the field injection instead of the constructor injection. So as a beginner I saw debates on it and many experienced devs suggest to use the constructor injection over the field injection.
@GenuineCoder
@GenuineCoder Ай бұрын
@@la-dev I understand the question clearly now. What you have read is correct. The @Autowired field injection is not recommended. Constructor injection is indeed the right way to do it. The Intellij IDE gives a warning (if you have the ultimate edition) when field injection is used. I have explained this on the chapter 4.3 in the spring boot dedicated tutorial kzbin.info/www/bejne/nJ6Xg6eOe86Dbbs&si=2CDzp4GnPRRlDM0Y. I haven't explained it explicitly in other tutorials like this since it's not fully relevant here.
@la-dev
@la-dev Ай бұрын
@@GenuineCoder Thank you so much for the reference and clarity.
@liabasqulizad7962
@liabasqulizad7962 2 ай бұрын
Thank you sir
@varunpareek7020
@varunpareek7020 3 ай бұрын
Hi sir I am getting Access to local host was denied error Do you know how can it be resolved!??
@GenuineCoder
@GenuineCoder 3 ай бұрын
Hi, Are you not able to access localhost on browser? If so, double check your spring boot server port.
@Damian64287
@Damian64287 3 ай бұрын
Hi! Thank you very, very much. How to get such cool world web icons for @RestController methods? :)
@GenuineCoder
@GenuineCoder 3 ай бұрын
I believe they come with the IntelliJ Ultimate edition. You can try IntelliJ Ultimate trial for free to checkout the latest spring and spring boot features.
@wfacts360
@wfacts360 Ай бұрын
Best !
@PoshanKumarSahu01
@PoshanKumarSahu01 Ай бұрын
thanks
@zairenninofranco3927
@zairenninofranco3927 5 ай бұрын
What about for the maven 😢 i have a hard time fixing the dependency since it uses javas and springboot 3 is using jakartae
@GenuineCoder
@GenuineCoder 5 ай бұрын
I prefer Gradle over Maven due to its more readable syntax, whereas Maven's XML configuration can be overwhelming. What specific challenge or problem are you experiencing with Jakarta EE, and is it related to upgrading from Spring Boot 2.X to 3.X?
@ahmedelkelany1884
@ahmedelkelany1884 5 ай бұрын
i have a question how 403 and 404 error page appears without mapping it or without adding GlobalErrorHandler ?
@GenuineCoder
@GenuineCoder 5 ай бұрын
This is a special feature. Without any java side configuration, you can customize the error pages for specific error codes directly from resources. "You can also customize the error pages by adding files with names like error.html, 404.html, etc., in the src/main/resources/public/error directory. The file name should match the HTTP status code you want to handle."
@meilyn22
@meilyn22 7 ай бұрын
Thank you!
@FreaksBane
@FreaksBane 5 ай бұрын
Nice work
@TEGUIAKAMEGNEDimitriAbel
@TEGUIAKAMEGNEDimitriAbel 2 ай бұрын
Thanks so muckh sir
@rambhaktuchihaobito7987
@rambhaktuchihaobito7987 4 ай бұрын
Thanku sir..!!
@vijayakumarsk
@vijayakumarsk 7 ай бұрын
Please put the actual code of the project into any repo as well
@GenuineCoder
@GenuineCoder 7 ай бұрын
Thanks for the suggestion. Here is the repo link github.com/afsalashyana/Spring-Boot-Tutorials/tree/master/LearnSpringSecurity
@malekhmaissy
@malekhmaissy 6 ай бұрын
is this doable with mongodb database or it necessites a rational database?
@GenuineCoder
@GenuineCoder 6 ай бұрын
It is doable in any database, including MongoDB. For MongoDB, instead of using Spring Data JPA, Spring Data MongoDB should be used.
@rohitnegi6862
@rohitnegi6862 5 ай бұрын
this is called Best
@indiancitizen6609
@indiancitizen6609 4 ай бұрын
bro. Your accent looks very similar to mine.
@MilsonPazienza
@MilsonPazienza 6 ай бұрын
very good content...
@josel9826
@josel9826 5 ай бұрын
perfect👌🏽
@nikhil4yourhelp670
@nikhil4yourhelp670 3 ай бұрын
can we use Roles as enum it look simple
@GenuineCoder
@GenuineCoder 3 ай бұрын
ENUM is a great idea! Handling role as an enum is definitely possible, and I think is better.
@meyrambzhusipp7156
@meyrambzhusipp7156 7 ай бұрын
it’s perfect 😅
@razek1998
@razek1998 6 ай бұрын
How to handle the situation of invalid credentials?
@GenuineCoder
@GenuineCoder 6 ай бұрын
You can use an "AuthenticationFailureHandler" to handle the invalid credentials. Using this, it is possible to provide customized error messages or even redirect the user to specific error pages. Reference: www.codejava.net/frameworks/spring-boot/spring-security-authentication-failure-handler-examples
@razek1998
@razek1998 6 ай бұрын
@@GenuineCoder thank you brother 🙏
@Carlosgh059
@Carlosgh059 4 ай бұрын
you have like, thanks
@subhbirajdar
@subhbirajdar Ай бұрын
May i know which laptop are you using
@GenuineCoder
@GenuineCoder Ай бұрын
@@subhbirajdar I am using a desktop, not laptop. Ryzen 3700X 32GB Ram Gigabyte X570 motherboard NVidia RTX 3060Ti Samsung 990 PRO SSD
@subhbirajdar
@subhbirajdar Ай бұрын
@@GenuineCoder please suggest me good laptop under 90k
@subhbirajdar
@subhbirajdar Ай бұрын
I want to use for java full stack development
@yadavharssh
@yadavharssh 4 ай бұрын
great
@naveenkumarreddybadduri7775
@naveenkumarreddybadduri7775 3 ай бұрын
God
@KarolKasperek
@KarolKasperek 5 ай бұрын
I LOVE YOU
@KarolKasperek
@KarolKasperek 5 ай бұрын
after checking all spring boot website and all of these tutorials with deprecated calsses this video just showed up
@kirillpopov3803
@kirillpopov3803 5 ай бұрын
cool man
@aleksandrnikolaev2914
@aleksandrnikolaev2914 5 ай бұрын
Where is the logic? You showed how to register a user in the database via the rest api, but did not show how to then log in to the server via the rest api by entering the username and password Postman. Because of this, a fairly good tutorial became a waste of time.
@Krishnadevaraya1
@Krishnadevaraya1 4 ай бұрын
bro from kerala
@GenuineCoder
@GenuineCoder 3 ай бұрын
അതെ.
@Krishnadevaraya1
@Krishnadevaraya1 3 ай бұрын
@@GenuineCoder basically iam from A.P I find you from Kerala by your slang
@sabinsesumariyan3687
@sabinsesumariyan3687 5 ай бұрын
he is malayali (from tamilanadu)
@GenuineCoder
@GenuineCoder 5 ай бұрын
Yes, Malayali from Kerala
@davidxcode
@davidxcode 7 ай бұрын
Thank you for this amazing content!
@jayakrishnathammana
@jayakrishnathammana 3 ай бұрын
Excellent explanation
Will A Guitar Boat Hold My Weight?
00:20
MrBeast
Рет қаралды 224 МЛН
Brawl Stars Edit😈📕
00:15
Kan Andrey
Рет қаралды 51 МЛН
2024-06 Unlocking the Full Power of Spring Security 6.3
1:22:10
Toronto Java Users Group
Рет қаралды 235
Spring Tips: Spring Security and Auth0.com
17:05
SpringDeveloper
Рет қаралды 3,5 М.
Will A Guitar Boat Hold My Weight?
00:20
MrBeast
Рет қаралды 224 МЛН