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

  Рет қаралды 561,512

Java Brains

Java Brains

Күн бұрын

Пікірлер: 455
@haimmichalashvili8251
@haimmichalashvili8251 4 жыл бұрын
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 3 жыл бұрын
@Haim you are a life-saver. Spent like 1 hour to find out what was wrong.
@alessandrosantana9606
@alessandrosantana9606 2 жыл бұрын
BIG THANKS MY MAN!
@swathikota
@swathikota Жыл бұрын
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.
@sarthakgupta290
@sarthakgupta290 Жыл бұрын
Your way of explaining complicated concepts in a simple manner is outstanding! Thank you so much!
@kuljeetkumar4657
@kuljeetkumar4657 5 жыл бұрын
This is what is required on KZbin. Kudos sir Bring full stack courses also. I bet 1 million is not far away then.🙌
@Sausty
@Sausty 4 жыл бұрын
Fantastic tutorial, probably the clearest tutorial I've ever watched on a pretty complicated subject. Thank you very much!
@brhaneweldeslase1289
@brhaneweldeslase1289 5 жыл бұрын
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."
@francogb
@francogb 5 жыл бұрын
Epic! Thank you! Please talk about integration with JWT
@SushilKumarBhaskar
@SushilKumarBhaskar 5 жыл бұрын
yes, eager to watch that integration with JWT,
@sujithg5873
@sujithg5873 5 жыл бұрын
Yess JWT 🙄🙄🙄🙄🙄
@reluscarlat7140
@reluscarlat7140 5 жыл бұрын
You can find well explained implementations of spring security with JWT in Laurentiu Spilca's spring security playlist: kzbin.info/www/bejne/sHKWpqusbbeAfJI 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! :)
@HanilKathuria
@HanilKathuria 4 жыл бұрын
Sir, you have made Spring Security so easy to understand. Thank you so much for your efforts😀
@manojkanna222
@manojkanna222 2 жыл бұрын
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
@monishad7040
@monishad7040 6 ай бұрын
Clearest tutorial with minimum time. Easy to understand. Thank you for wonderful lectures sir.
@Sebriniel
@Sebriniel 4 жыл бұрын
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!
@AnantaAkash.Podder
@AnantaAkash.Podder 9 ай бұрын
By Far the Best Explanation of Spring Data JPA with Spring Security...got many concept cleared out of this Tutorial
@damianw345
@damianw345 4 жыл бұрын
wow, these are the best tutorials on Spring Security I have ever found on the Internet. Please keep up the good job :)
@SushilKumarBhaskar
@SushilKumarBhaskar 5 жыл бұрын
Yes Correct, read query many times for authentication/authorization, we might consider using LDAP. LDAP has fast read query.
@Java.Brains
@Java.Brains 5 жыл бұрын
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.
@midhunma8875
@midhunma8875 4 ай бұрын
Thanks, this is the clearest from scratch video i found so far..so difficult to explain yet you made it look easy
@TomosLeggett
@TomosLeggett Жыл бұрын
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!
@tsegaighebremedhin5536
@tsegaighebremedhin5536 5 жыл бұрын
Great Job Koushik!!! I like your teaching style and JavaBrains has been my main source of learning SpringBoot and java related stuff lately!!
@priyankjoshi3018
@priyankjoshi3018 3 жыл бұрын
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.
@bibekdas3592
@bibekdas3592 4 жыл бұрын
You are doing a great service by sharing all these...no praise will ever be enough..👍👍👍
@umairkhan4085
@umairkhan4085 4 жыл бұрын
if @Autowired UserDetailsServices in SecurityCnfiguration is showing error it is due to multiple implementations of that interface spring is confused which one to choose. solutiion :add @Primary annotation above MyUserDataService class that will give preference to your implementation
@hrvooje
@hrvooje 3 жыл бұрын
Or use @Qualifier("myUserDetailsService") @Autowired UserDetailsService userDetailsService;
@badripaudel77
@badripaudel77 3 жыл бұрын
Did anyone try , this project no longer works ? I cloned it and it doesn't work. Says forbidden (403).
@nitiKT
@nitiKT Жыл бұрын
Sir, hatsoff to you.. you made learning spring security enjoyable for me.. being dyslexic I hated spring security..
@vurihur4533
@vurihur4533 2 жыл бұрын
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!!!
@jfaber1026
@jfaber1026 4 жыл бұрын
It's importante to note that you must add the prefix ROLE_ in MyUserDetails class otherwise it could return a 403 when trying to log in.
@srigunakrishnamoorthy1670
@srigunakrishnamoorthy1670 4 жыл бұрын
Thanks for this.. i have been facing this issue.. But , how can we get rid of this explicitly.
@sheelstera
@sheelstera 5 жыл бұрын
Great start to the weekend.. God bless.. Please cover JWT, OAuth and SAML
@Torayasu
@Torayasu 2 жыл бұрын
Clear and simple, managed to implement my own JPA authorization provider thanks to this video. Great Job !
@deeptiadmile9986
@deeptiadmile9986 4 жыл бұрын
This security series is absolutely amazing !! All aspects for each type covered.. 😀👍
@mohitpatidar8880
@mohitpatidar8880 3 жыл бұрын
You are doing fabulous work Sir...( Y) Hats off to you for giving so much content to the community for free.
@dinunclv
@dinunclv 7 ай бұрын
really good series of tutorials. Great Job! Since spring 6 some things have slightly changed, but you explain the core principles very well. Thanks!
@SushilKumarBhaskar
@SushilKumarBhaskar 5 жыл бұрын
Please🙏 upload LDAP supported Spring security ... Eager to watch
@s3649
@s3649 4 жыл бұрын
kzbin.info/www/bejne/Y6inhnaenNuMnbc
@dineshshekhawat2021
@dineshshekhawat2021 4 жыл бұрын
17:20 Spring boot verison 2.3.1.RELEASE When creating a dummy UserDetailsService, you also need to comment out the spring-boot-starter-data-jpa in the pom.xml else the server application will fail to start.
@arunkumarjaiswal4562
@arunkumarjaiswal4562 4 жыл бұрын
Thanks bro , i was thinking the problem was in Mysql
@tabrezshaikh7705
@tabrezshaikh7705 4 жыл бұрын
I thought there was a problem in SQL server and I was going to remove the mysql driver dependency from the pom.xml Thanks for your help @Dinesh Shekhawat
@zephyrred3366
@zephyrred3366 4 жыл бұрын
It's actually a problem with having 2 UserDetailsService beans. You have to qualify which to use.
@ВладиславР-ф2ъ
@ВладиславР-ф2ъ 3 жыл бұрын
@@zephyrred3366 so which to use?
@hetalpadia8381
@hetalpadia8381 2 жыл бұрын
@@zephyrred3366 @Qualifier doesnt work.It gives the same error
@AvazkhonNazirov
@AvazkhonNazirov Ай бұрын
Best tutorial ever! It is definitely worth your time
@dhananitejendra3151
@dhananitejendra3151 10 ай бұрын
By far the best tutorials on spring security. Thanks a lot
@sugoi5240
@sugoi5240 9 ай бұрын
your explanation is so good i wanna cry
@divtosz
@divtosz 4 жыл бұрын
Thank you so much! You explain so clearly, much better than all the paid courses online! 😄
@awadijohan
@awadijohan 5 ай бұрын
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 ♥
@Mohamed-uf5jh
@Mohamed-uf5jh 4 жыл бұрын
Thanks sir, these are the best tutorials on Spring Security I have seen on the Internet
@AshenafiMaru-ul3rg
@AshenafiMaru-ul3rg Жыл бұрын
I never knew . . . Spring Boot Security is this easy . . . thanks to you brother!
@igorgvozdic2769
@igorgvozdic2769 4 жыл бұрын
I have watched a ton of similar videos, but your videos are best by far!
@thornton
@thornton 4 жыл бұрын
Thank you so much! This unblocked me on a problem I was having with my Repository.
@Runa_Nura
@Runa_Nura 4 жыл бұрын
The best video for Security. easy to understand and all codes works fine. Plz Mr make more videos for spring.
@GreatAnubis
@GreatAnubis Жыл бұрын
I've been looking for such tutorial. Great video. Thank you!
@shivaakrish
@shivaakrish 2 жыл бұрын
This is one of the best tutorial i have seen in my entire life :D Thank you so much.
@DrunkenEngineer
@DrunkenEngineer 4 жыл бұрын
Thank you for uploading such video's. Really helps a lot in Interviews.
@barathkumar8740
@barathkumar8740 4 жыл бұрын
I changed the Naming Strategy in properties as the one used in this tutorial is deprecated in Hibernate 5 spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
@kulashaker30
@kulashaker30 3 жыл бұрын
This fixes my issue as well.
@yazidelhachimi1628
@yazidelhachimi1628 3 жыл бұрын
The best tutorial i've seen on youtube !! Thanks man !
@Frederic_Chopin.
@Frederic_Chopin. 3 жыл бұрын
If you are getting a 403 make sure that the role column in USER table = "ROLE_ADMIN"
@RDSRao
@RDSRao 4 жыл бұрын
Thank you once again, Kaushik for your time and teaching!
@ashiqmohamed6675
@ashiqmohamed6675 3 жыл бұрын
I tried the Exact same as you explained. But when I login with "/admin" {There was an unexpected error (type=Forbidden, status=403).} this error is comming. Please help
@liferayasif9382
@liferayasif9382 4 жыл бұрын
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.
@makarandahire2133
@makarandahire2133 4 жыл бұрын
We are just passing the username for fetching the user details, how does the password is verified during authentication. As in all cases till now we are not verifying the password.
@nageshmath9376
@nageshmath9376 5 жыл бұрын
Art of coding ,simple and quick
@mojammilkhan4973
@mojammilkhan4973 3 жыл бұрын
Great tutorial!!!. btw for authorization, since we are using authorities in Userdetails, we should use hasAuhtority instead of hasRole. .antMatchers("/admin").hasAuthority("ADMIN") .antMatchers("/user").hasAnyAuthority("USER","ADMIN").
@gpr1983
@gpr1983 3 жыл бұрын
Thanks, i was scratching my head with the 403. This helped.
@prakharsaxena4685
@prakharsaxena4685 3 жыл бұрын
yes so true
@SirimallaDinesh
@SirimallaDinesh 2 жыл бұрын
Thanks
@AbhishekKumar-bl4hz
@AbhishekKumar-bl4hz 2 жыл бұрын
@@gpr1983 same here.. Mojammil khan thankyou
@sanskarsharma100
@sanskarsharma100 2 ай бұрын
Thanks i was stuck here for a long time
@arashaadd
@arashaadd 2 жыл бұрын
this man is the greatest of all time!!!
@akhilsamineni4628
@akhilsamineni4628 4 жыл бұрын
Really AWESOME!! One of the best videos I watched.
@iljatarasovs4416
@iljatarasovs4416 4 жыл бұрын
If u are getting 403 error. Change SQL insert example: insert into user (username, password, isactive, roles) values ('admin', 'admin', true, 'ROLE_ADMIN'); //or 'ROLE_USER' but not 'USER'
@ankitbangera7261
@ankitbangera7261 3 жыл бұрын
Thank you, It worked :)
@backtoGodhead0
@backtoGodhead0 3 жыл бұрын
Excellent, Thank you Kaushik, May God bless you!
@bendego2800
@bendego2800 4 жыл бұрын
Thanks for coming back !!
@orhanyarar7552
@orhanyarar7552 4 жыл бұрын
thank you very much for putting this together. Your explanations are very clear, concise and to the point!
@yuhaoli2450
@yuhaoli2450 4 жыл бұрын
If your authorization not working properly after fetch user info from database, remember to name the roles in your DB like "ROLE_USER", "ROLE_AMDIN". Otherwise, your hasRole method will not work!!!!!
@itssandesh
@itssandesh 4 жыл бұрын
Thanks for help.Now my project is working
@mlprasad79
@mlprasad79 5 жыл бұрын
This is good stuff ! Now my weekend is productive as I learned something new from this ! Long live KK !
@rupeshsharma2453
@rupeshsharma2453 3 жыл бұрын
A very informative video on spring security. Thanks a lot. Cheers
@drawlzlolwlz5953
@drawlzlolwlz5953 3 жыл бұрын
Finished the tutorial! great job and explanation
@wildanekaputra912
@wildanekaputra912 Жыл бұрын
Sir, you deserve a noble.
@abukasozi295
@abukasozi295 5 жыл бұрын
This is pure awesomeness thankyou very much. Amazing!!!!
@abhisheksengupta4159
@abhisheksengupta4159 5 жыл бұрын
Best video on spring security !! Thanks Kaushik :)
@vasileiosstamos5940
@vasileiosstamos5940 5 жыл бұрын
Spring Security + JWT Authentication would be superb!
@dimimurik3970
@dimimurik3970 3 жыл бұрын
Very good tutorial, nice and clear explanations. Thanx a LOT!!
@mitalijena1181
@mitalijena1181 4 жыл бұрын
I tried the JPA with MySQL but I am getting bad credentials. Could you please help me with this??
@jijuka78
@jijuka78 4 жыл бұрын
Please emphasis that SecurityConfiguration has "ADMIN" while SimpleGrantedAuthority is ROLE_ADMIN Though some people knows Spring security, some don't know.
@mritunjayyadav3788
@mritunjayyadav3788 4 жыл бұрын
did you get your answer ?
@jijuka78
@jijuka78 4 жыл бұрын
@@mritunjayyadav3788 yes, thanks
@mritunjayyadav3788
@mritunjayyadav3788 4 жыл бұрын
@@jijuka78 please share it with me too
@rashidaryan
@rashidaryan 4 жыл бұрын
@@mritunjayyadav3788 Please share it with me too
@rashidaryan
@rashidaryan 4 жыл бұрын
@@jijuka78 Please share the answer with me too.
@SrivatsaLakshmi
@SrivatsaLakshmi 3 жыл бұрын
Fantastic tutorial. Well explained and easy to follow along.
@firozgg7524
@firozgg7524 4 жыл бұрын
Tjank you so much brother... It was the best spring security tutorial i've ever watched so far...💜
@AdrianVrabie
@AdrianVrabie 4 жыл бұрын
Indeed, very well explained! I loved it! Subscribed + Shared!
@RajdeepBarman
@RajdeepBarman 3 жыл бұрын
Could you make few tutorials that talks about handling user session management after login, thread local etc
@ankitank1990
@ankitank1990 4 жыл бұрын
Thanks for your hard effort to make the things done. Awesome
@rudranarayandash1466
@rudranarayandash1466 5 жыл бұрын
Before I watched I just click like button 👍
@Chanakya0000
@Chanakya0000 2 жыл бұрын
You made it look so easy. Thank you.
@srikarmadhavapeddy9881
@srikarmadhavapeddy9881 3 жыл бұрын
In the MySQL implementation, where are you verifying the password? You are simply taking the username, getting the user details, and passing it to MyUserDetails(). Does that mean, for the above code, you can give any password and it will work?
@exit123ty
@exit123ty 4 жыл бұрын
In sql database active data type is ?
@samedsakhri5117
@samedsakhri5117 4 жыл бұрын
Best I've ever seen on youtube .. thks man 😀👍
@prageethjayasinghe709
@prageethjayasinghe709 3 жыл бұрын
Perfect teaching skills.
@ashokmandadi
@ashokmandadi 4 жыл бұрын
very good video bout spring security, usage of lamda expression also very nice
@ChathushkaPeiris
@ChathushkaPeiris 2 жыл бұрын
this is exactly i was looking for! thanks!
@ivanetinajero
@ivanetinajero 5 жыл бұрын
Great Video. God bless you. Regards from Mexico!
@priscillavannyamelia8736
@priscillavannyamelia8736 Жыл бұрын
Amazing tutorial, thank you for creating this video
@francescodigiuseppe73
@francescodigiuseppe73 4 жыл бұрын
Thanks a lot Prof, you're my best teacher
@deepakkakkar7698
@deepakkakkar7698 6 ай бұрын
Awesome explanation man,
@FranklinXPe
@FranklinXPe 4 жыл бұрын
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 4 жыл бұрын
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!
@souvikdasgupta8960
@souvikdasgupta8960 4 жыл бұрын
Very nicely explained. Can you make a tutorial on Spring security + oauth2
@beginner-techies6793
@beginner-techies6793 4 жыл бұрын
wow , amazing explanation, waiting your video on spring boot with keycloak
@Ashrays_melodies
@Ashrays_melodies 2 жыл бұрын
some DBs (like postgresql) does not allow to create database with name 'springsecurity' and table with name 'user' .. probably because they are reserved words .. try using different names in such cases
@anaghavarhade7375
@anaghavarhade7375 4 жыл бұрын
Thank you so much for these videos. They are very helpful ❤❤❤
@mihaicosminmavrodin831
@mihaicosminmavrodin831 3 жыл бұрын
Quick question: I have understood and implemented all of this. I have a user that exists inside the DB, and when I try to log him in, all is fine, I get a jwt back and all of that stuff. But when I try to access the /login rest point with invalid credentials, I get a 403 forbidden instead of "username not found". What am I doing wrong? Note: I also set my requests to permitAll(), so that's not to blame.
@ArvindYadav-cn4md
@ArvindYadav-cn4md 4 жыл бұрын
Great job Sir. This is what required.. thank you v much.
@sumitchhonker6518
@sumitchhonker6518 3 жыл бұрын
Hey Koushik, Please use white background for IntelliJ - its difficult to view
@Sergio-di1jt
@Sergio-di1jt 4 жыл бұрын
Suscribed and like and thanks
@maheshshelke4989
@maheshshelke4989 Жыл бұрын
This tutorial is really helping me alot. Explained so perfectly. here we have created our MyUserDetailsService, but autowired instance of UserDetailsService. Still worked !! Should we MyUserDetailsService ?
@AkhileshKumar-cs2kh
@AkhileshKumar-cs2kh 4 жыл бұрын
ROLE prefix is the default behaviour of SimpleGrantedAuthority. It took me some time to figure out why Authorization was failing. It was due to this prefix .
@selvakumarm8948
@selvakumarm8948 4 жыл бұрын
Sir, Thanks for you effort to provide us great quality content. I really like your video style. :)
@thiyakarasanrk8744
@thiyakarasanrk8744 2 жыл бұрын
Video is great and usefull. Use mvcMatchers instead of antMatchers for trailing slash / issue. We may use hasAuthority in place of hasRole. This not required ROLE_ prefix in code as well as database.
@arungore6578
@arungore6578 5 жыл бұрын
Early morning .. good start
Spring Boot + Spring Security + LDAP from scratch - Java Brains
18:16
Spring Boot + Spring Security + JWT from scratch - Java Brains
39:29
Je peux le faire
00:13
Daniil le Russe
Рет қаралды 22 МЛН
Inside Out 2: BABY JOY VS SHIN SONIC 3
00:19
AnythingAlexia
Рет қаралды 6 МЛН
escape in roblox in real life
00:13
Kan Andrey
Рет қаралды 79 МЛН
小丑在游泳池做什么#short #angel #clown
00:13
Super Beauty team
Рет қаралды 43 МЛН
Top 25 Microservice Interview Questions Answered - Java Brains
39:54
How Spring Security Authentication works - Java Brains
19:36
Java Brains
Рет қаралды 300 М.
What is JWT? JSON Web Tokens Explained (Java Brains)
14:53
Java Brains
Рет қаралды 1 МЛН
Spring Security: Spring Security + REST + JWT
1:52:13
Александр Фисунов
Рет қаралды 46 М.
4 Spring Boot Mistakes to AVOID in 2024
15:18
Java Brains
Рет қаралды 60 М.
What is the structure of a JWT - Java Brains
17:46
Java Brains
Рет қаралды 401 М.
What is JPA? | JPA Implementation
26:21
Telusko
Рет қаралды 384 М.
Je peux le faire
00:13
Daniil le Russe
Рет қаралды 22 МЛН