Тёмный

Spring Boot and Spring Security with JWT including Access and Refresh Tokens 🔑 

Amigoscode
Подписаться 1,1 млн
Просмотров 596 тыс.
50% 1

Опубликовано:

 

30 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 823   
@gt-uj6fz
@gt-uj6fz 2 года назад
hello, i realized that websecurityconfigureadapter is deprecated since springboot 2.7.0. Are you going to make video of how to use it , mean without using websecurityconfigureadapter, i tried to apply it, it did not work for me? thanks
@mookayreet8518
@mookayreet8518 Год назад
WebSecurityConfigurerAdapter depreciated. Need help introducing SecurityFilterChain please.
@thomasandolf7365
@thomasandolf7365 Год назад
this entire tutorial is full of bad practices and it is outdated. And is using JWTs as session holders which is VERY INSECURE. You should NEVER use this tutorial. He is basically building functionality that already exists in spring security but he is building it worse and much more insecure. He clearly has absolutely no idea how security actually works. Handling of JWTs has existed in spring security since 2017. This clearly shows that the author hasn't even read the official spring security documentation as he seems totally unaware of this fact. Why use a security framework if you do not intend to use its features? Writing a custom solution like this adds more 3rd party dependencies to your project, makes code harder to maintain and is more likely to break in future updates. Also if you accidentally introduce a bug the entire application and its data may be compromised. Its sad that "youtubers" are not better informed, and actually read documentation before making these videos and posing as some sort of expert.
@kannanpadmakumar278
@kannanpadmakumar278 2 года назад
Where's the source code?
@saywuat
@saywuat 3 года назад
I'm impressed - you provided a full example of a JWT implementation. I can follow each step and you explain every step very well. Trying to look all of this stuff up by myself would have cost me months. THANK YOU, SIR!
@koles32
@koles32 2 года назад
can we get updated version? This method was deprecated in 5.7.0
@meseretkassaye8550
@meseretkassaye8550 2 года назад
why u guys didn't share the source code on git. we need to read it not copy paste it.
@Renardbardhi1
@Renardbardhi1 2 года назад
I just wanted to ask about the end point "/login" I did not see it somewhere. Please can you explain when you sue /login end point the flow on the code works? Thank you very much
@dedvano9533
@dedvano9533 2 года назад
1:30:10
@demolearning267
@demolearning267 2 года назад
WebSecurityConfigurerAdapter deprecated 🤔
@alexanderkolosov1371
@alexanderkolosov1371 2 года назад
That's awesome as always! It would be also really helpful if you could show us how to configure security without WebSecurityConfigurerAdapter, cause it's deprecated since Spring Security 5.7.0-M2. Thanks!!!
@JamesSmith-us3ne
@JamesSmith-us3ne 2 года назад
I had the same issue, I decided to change my Spring Boot version to
@chernomorets2000
@chernomorets2000 2 года назад
@@JamesSmith-us3ne See my comment above
@rakharafif4977
@rakharafif4977 2 года назад
Hello, i can login with x-www-form-urlencoded, but when i using json username and password is null, how can i fix it?
@BehruzAnvarov-f8b
@BehruzAnvarov-f8b Год назад
could you write frontend to this application with your specific design because it would be a great masterclass from cosmopolitan developer like you for Junior developers like me, I'll wait it's front.Thanks,brotha
@mohamedaminhajri7632
@mohamedaminhajri7632 Год назад
Hello 👋 Please can you make an updated version of this video since the webSecurityConfigurerAdapter is deprecated and spring recommend using the Filter chain concept Thank you 😊
@maxjustmax521
@maxjustmax521 2 года назад
After the WebSecurityConfigurerAdapter class got deprecated the whole course is hard to follow now.
@avm0101
@avm0101 2 года назад
This is a fantastic tutorial. Even-though some of the concepts like "WebSecurityConfigurerAdapter" are deprecated, it was good to know. This is the first time I have actually understood the flow of authentication and authorization. Thank you.
@serdaratadurdyyew1333
@serdaratadurdyyew1333 3 года назад
It would be nice to add front-end to this project, to see how the front side of the application deals with the tokens
@AKIvarma
@AKIvarma 3 года назад
am stuck here like i have to post the data through front end tried everything
@nitestrikebg
@nitestrikebg 2 года назад
​@@AKIvarma you can use postman/curl/any other tool that does requests or write some tests to simulate the requests and etc to do what you want.
@OldManRog
@OldManRog 3 года назад
This was a fun project, I learned how to secure my API routes, how to authenticate & authorize as well as sending a refresh token. It would be awesome if you do this project again but with the best practices. Maybe like a follow up or more advanced video. Thank you both of you guys for providing such an informative tutorial.
@brandonalfaro42
@brandonalfaro42 Год назад
I know I'm a bit late but did you also name your main entity class "User". I named my Employee and then used the User class from the security package. And I'm struggling to figure out which one to use for the refresh token part.
@anasjiyar8517
@anasjiyar8517 9 месяцев назад
@@brandonalfaro42 you have to use your personal class User, beacause he use the repository on it.
@nunoaparicio4426
@nunoaparicio4426 3 года назад
Yesterday I was looking for this exact tutorial on your channel and today you upload this! Just perfect! Thanks 😁
@sumonbappi
@sumonbappi 2 года назад
where is the source code? can somebody provide link please
@ram0973
@ram0973 3 года назад
Who knows, which Idea theme is it?
@KishoreKumar-sl6fk
@KishoreKumar-sl6fk Год назад
Wonderful course !!! Thanks a ton for taking time and coming up with something this good. its very helpful.!!! Unable to find the GITHub link for this tutorial, pls share github link 😞
@gt-uj6fz
@gt-uj6fz 2 года назад
this is amazing project. but i can not find the source code.
@eliasnicolas6443
@eliasnicolas6443 2 года назад
So sad this is being deprecated. It should not be used for new projects
@ArthurSilva-mb5fq
@ArthurSilva-mb5fq 2 года назад
Source Code: github.com/getarrays/userservice
@connarjohn533
@connarjohn533 3 года назад
thanks brrrooooo!!,but where can i download you color theme for java ? it is so fancy!
@ImCaveJohnson
@ImCaveJohnson 2 года назад
Great video. Honestly JWT takes way too much code in Springboot. Node.js boiler plate JWT code is 1 file and maybe 30 lines of code.
@johnwozniak6110
@johnwozniak6110 2 года назад
Color theme?
@yasirusandeeptha6592
@yasirusandeeptha6592 3 года назад
Is there any Github repo?
@JohnDoe-ej6vm
@JohnDoe-ej6vm 2 года назад
i need github repo of this project.
@jay-rathod-01
@jay-rathod-01 Год назад
No
@soromiso
@soromiso Год назад
Thanks, Amigo, it helps me a lot
2 года назад
Hello! Thank you very much!! Now WebSecurityConfigurerAdapter seems to be deprecated, any suggestions?
@HouariZegai
@HouariZegai 3 года назад
Amazing like always Nelson! Thanks for the richest content you provide to the community.
@Trieuat_Vo
@Trieuat_Vo Год назад
Sorry Sir, but I confused that this video U had posted in 2020 and 2023 you post another video about JWT so what is different from 2 video sir? Can I use JWT in this video? Thank You.
@yassinsaddem2262
@yassinsaddem2262 3 года назад
what theme you use for intellij idea?
@bartdiako1
@bartdiako1 3 года назад
Is there a git repo that we can chek out?
@DatGunitKilla
@DatGunitKilla 2 года назад
Following this tutorial, it's cool so far, good lookin' out! Just a little comment: you mentioned calling the class "User" is a bad idea, but actually, it's a terrible idea. I picked PostgreSQL instead of MySQL, and apparently, User's a restricted keyword there, so it was crashing, until I changed User into something else ("Member" in my case)
@jdn4151
@jdn4151 2 года назад
I encountered the same problem, luckily I decided to check the comments pretty quickly. Thank you, you saved me hours of debugging and research!
@zeki7540
@zeki7540 2 года назад
%100, thank you.
@lakeshbiyala3190
@lakeshbiyala3190 2 года назад
Thanks buddy.
@mixelx
@mixelx 2 года назад
You also can specify table name like @Table(value="users") on entity and postgres accepts it
@zakharborisov1841
@zakharborisov1841 Год назад
also you can add new property in applicatiom.properties file: spring.jpa.properties.hibernate.auto_quote_keyword=true This will be add quote to keywords
@NishaSingh-xh1ih
@NishaSingh-xh1ih 3 года назад
Can you please provide source code? It is much needed.
@muzaffarmuratov2321
@muzaffarmuratov2321 Год назад
Thank you guys for a wonderful video! One question: when sending a request without authorization header i am not receiving any body message, as shown in the video. Just status 403 Forbidden. that is it. Did anyone face similar issue?
@hajjimohamedamine2451
@hajjimohamedamine2451 Год назад
I faced the same issue, please if you find a solution tell me.
@TheBodybuildingG
@TheBodybuildingG 2 года назад
Hy, need some help/clarification , at 1.24 when u test in postman , how does the passwords get matched ? because I am following along and I get a message " encoded password does not look like BCrypt" ....tks
@TheBodybuildingG
@TheBodybuildingG 2 года назад
So i figured it out , at 58.16 when he overrides the loadUserByUsername , when he return the User u must add ---> .User(user.get().getEmail(), new BCryptPasswordEncoder().encode(user.get().getPassword()), authorities); --> so the password get encoded to for compare. Hope it helps others stuck maybe!
@ДенисСултанов-ю4п
@ДенисСултанов-ю4п 2 года назад
@@TheBodybuildingG Thank you, brother
@natsuo8302
@natsuo8302 2 года назад
Anybody knows, what color theme is it?
@lurby89
@lurby89 2 года назад
Is possible to implements this configuration to an angular frontend login and registration forms?? Thank you
@DavidMac94
@DavidMac94 2 года назад
Great video. One word of warning though. Be careful catching all exceptions as is done in doFilterInternal method as is done at 1:43:50. Any exceptions coming from later in the filter will be caught here and you may end up with a red herring "401 unauthorized error" which is nothing to do with authorization. I hope this saves someone the frustration of trying to debug an authorization problem which isn't even there.
@adeniyiadekoya4187
@adeniyiadekoya4187 2 года назад
Yeah, better to catch JWTVerificationException
@markstart00
@markstart00 2 года назад
settings -> playback speed -> 0.75
@santeixeira9301
@santeixeira9301 Год назад
Most of the security configuration are deprecated, so you'll have to reed de Spring Security documentation to solve those Services in 50:00
@pashok1228
@pashok1228 3 года назад
Hi, thanks a lot for a decent guide to jwt and security. Can you tell me which theme for idea you are using? I like it very much))
@ДанилаКононихин
@ДанилаКононихин 2 года назад
If I see 404 error when I'm trying to access to localhost:8080/login, what should I do?
@mateenbagheri
@mateenbagheri 2 года назад
This is a good tutorial. however, the problem is that WebSecurityConfigurerAdapter is now deprecated thus, the method used in second section is not reliable now. You could try to use different methods but it breaks your course path and might get you confused.
@dnlnfr
@dnlnfr 3 года назад
Hi Nelson, I follow your channel and I started programming in Java thanks to your really well done videos. The passion you transmit in teaching is incredible. I am still very inexperienced and I am approaching software applications with microservices architectures. I'm struggling a bit to understand how to start a microservice and how to get them to communicate with them. I can't quite understand how to integrate Docker and Kubernetes. When you get the chance will you be able to make a small example of how to create multiple microservices in spring boot and integrate Docker with Kubernetes? Thanks Nelson. Support from Italy!
@amigoscode
@amigoscode 3 года назад
Hi 👋🏿 thanks for the comment. Coming soon what you are asking
@dnlnfr
@dnlnfr 3 года назад
@@amigoscode Thank you so much Nelson!
@preto115
@preto115 2 года назад
I would love to see this examples of microservices talking to each other! Thanks Nelson!
@miltonfrancis4144
@miltonfrancis4144 2 года назад
Awesome video but how do I get the code?
@HamSoft
@HamSoft 3 года назад
Where is the method in the controller that receives login/form request?
@markusjost5808
@markusjost5808 Год назад
I think you also need to verify if the refresh-token is not an access-token. Otherwise, a compromised, but still valid access-token can be used to get a new refresh-token, making the entire refresh-token business irrelevant.
@cdev9116
@cdev9116 Год назад
You're right, also a refresh token could be used to access app resources
@andreasaltwegg576
@andreasaltwegg576 3 года назад
cool video .. only thing .. when sending a refreshToken to get a new accessToken, it is good practice to create a new refreshToken as well. small thing but it helps, that the refreshToken always has longer expire date-time then the accessToken.
@Itech6969
@Itech6969 2 года назад
what color theme are you useing in IntelliJ ?
@zdenekpodmesil8422
@zdenekpodmesil8422 Год назад
From time 1:55:00 it is a total mess..
@shimisadaka9990
@shimisadaka9990 2 года назад
Thank you! this was very powerful tutorial! which color theme do you use here? :)
@elisabethfournier9941
@elisabethfournier9941 Год назад
This tutorial is amazing! Since the WebSecurityConfigurerAdapter has been deprecated in the latest version of Spring Boot/Security, is there a new video planned to update the content of this portion of the tutorial? It would be nice to see how set the SecurityConfiguration class using the @EnableGlobalMethodSecurity annotation, use the SecurityFilterChain class. Meanwhile, I'll try to convert that portion of the tutorial and figure it out. Again, thank you! Very informative!
@lifeTechnicolorGuy
@lifeTechnicolorGuy Год назад
Nice explanation. do you have a github with the code?
@thebibeksaha
@thebibeksaha 2 года назад
What is the theme in your intellij?
@shoeb.joarder
@shoeb.joarder 2 месяца назад
@2:01:29 you can replace *.equals()* with *.startsWith()* to allow the endpoints starting with a prefix. Therefore, a possible solution is _request.getServletPath().startsWith("/api/token")_
@manishmanirathnam6281
@manishmanirathnam6281 3 года назад
thanks nelson for this good content , may i know what theme you are using in Intellij?
@tarekbellalouna9310
@tarekbellalouna9310 2 года назад
Amigoscode please , the ressource "/login" where and where did you put it ?
@MotivateSphere458
@MotivateSphere458 Год назад
hey, this was a great project, but I have a simple problem with the WebSecurityConfigurereAdapter. I can't import it, can you help me with that. thanks anyway.
@luca1989
@luca1989 Год назад
I have the same problem it is desprecated but i find it very difficult with the new method. i dont get it by now.
@AKIvarma
@AKIvarma 3 года назад
am stuck here like i have to post the data through front end tried everything
@jordantanjunwen175
@jordantanjunwen175 2 года назад
1:20:24 The code after "Collector" can't be seen clearly
@MrMiruendano
@MrMiruendano 2 года назад
I have followed this excellent tutorial and it works fine, but the refresh token endpoint can be accessed using the access token instead of the refresh token. Is this behavior okay? If an attacker steals the access token, they could refresh it indefinitely without needing to know the refresh token. Anyway, thanks for your work!
@ramazanaktas748
@ramazanaktas748 2 года назад
WebSecurityConfigurerAdapter is deprecated?
@mixelx
@mixelx 2 года назад
yes
@90sokrates
@90sokrates 2 года назад
Does anyone know what intellij theme is he using in this video? It is great.
@trongnguyenduy4154
@trongnguyenduy4154 2 года назад
If anyone having problem with PostgreSQL, just change User class to some other name like AppUser
@FranciscoJavierRincon
@FranciscoJavierRincon 3 года назад
I'd really appreciate having the git repository for this project. Great job.
@rullback85
@rullback85 2 года назад
Assalamo alaykom bro@Amigoscode, please can you show me how to use the "secret" key from the application.properties, thanks a lot
@ClearAngel
@ClearAngel 2 года назад
Where is source code ?
@PhucNguyen-te5hx
@PhucNguyen-te5hx 2 года назад
Thank you very much for your video. I have 1 problem is i got 403 Forbidden error when trying to access login url. I am follow your code but i still can not access the login url.
@NitrosS
@NitrosS 2 года назад
Did you fix it???
@ukemeelijah6336
@ukemeelijah6336 2 года назад
@@NitrosS I'm having the same issue here, if anyone has fixed it please share the tips on how to resolve it
@xYoyoq
@xYoyoq 3 года назад
Logic and nested class in the controller....verb in the path of the request methods....and more....I liked Nelson's Spring security tutorial, but I had to skip this one, made by the other guy.
@zagteam442
@zagteam442 2 года назад
Hey I know it's been a while since you uploaded this video but you said you would make the source code available. Would you be able to update the description with a link to the source code please :)
@gficeis
@gficeis 2 года назад
Simple, direct and efficient. You have the gift of explaining! Nothing more to say. Thank you sir!
@glorieus27
@glorieus27 2 года назад
Thankyou Nelson. You are awesome. I want to ask something. How to implement logout functionality in Spring Boot?
@trokopeemmanueljunior2013
@trokopeemmanueljunior2013 3 года назад
Can you share github repo please ?
@alfredomenezes8814
@alfredomenezes8814 2 года назад
Amazing tutorial, the best one about Spring Security and JWT I've seen so far, thank you very much for posting this for free!
@McWickyyyy
@McWickyyyy 2 года назад
At 1:20:08 your screen cuts out on the far right side when dealing with setting up the roles as claims. What is the last part of that statement? .collect(Collect.......
@Emerald214
@Emerald214 2 года назад
1:48:30 Hey, I didn't see this error but just 403 status code. There shouldn't be a JSON response body because missing "Bearer" results in going to the last else block which doens't handle JSON response.
@brando3179
@brando3179 2 года назад
This helped me tremendously
@ukemeelijah6336
@ukemeelijah6336 2 года назад
@@brando3179 Please how did you resolved the issue because I'm facing the same thing here
@brando3179
@brando3179 2 года назад
I can’t exactly remember but you might have to put runtime exception in the last else block. Tbh if you want to actually learn spring security I would watch laur spilicas videos
@kaydanderson4487
@kaydanderson4487 2 года назад
@@brando3179 I'm facing the same, I'd really appreciate it if you could double check?
@tarekbellalouna9310
@tarekbellalouna9310 2 года назад
Amigoscode please , the ressource "/login" where and where did you put it ?
@jacquelineortea9157
@jacquelineortea9157 2 года назад
Just you have tu add the dependency of spring security on your pom.xml
@jacquelineortea9157
@jacquelineortea9157 2 года назад
org.springframework.boot spring-boot-starter-security
@IgorTrono
@IgorTrono 3 месяца назад
WebSecurityConfigurerAdapter is deprecated (SecurityConfig class). I guess the video needs to be updated (50').
@chandlerslowly
@chandlerslowly Год назад
where can i get the code of this class?
@andrelong7230
@andrelong7230 Год назад
public class userServiceImplementation implements userService class. (roughly 27 min into the video) The problem is that eclipse is telling me that "getRoles()" is undefined for this class which is true, nowhere is this functionality defined in the application. Has anyone else had this problem? Or the original source code for this video, I can't find it.
@skumakerguitar8708
@skumakerguitar8708 3 года назад
Asswrwb please cover spring kafka sir 🙏🏻 you’re the best teacher i just bought full stack spring react
@hilmiterzi3847
@hilmiterzi3847 3 года назад
Interesting how other programmers on RU-vid make you feel stupid by explaining things really bad (not sure if they do this on purpose). It's nice to see Nelson breaking this culture. And now it's RU-vid's turn to get his Algorithm's straight!
@YuvrajSingh-iw8pm
@YuvrajSingh-iw8pm 2 месяца назад
can someone help me? i a trying to use postman. But Post requests give a 401 error. It may be because of token. How can i get token?
@ucphan1499
@ucphan1499 3 года назад
I don't see the source code in description. Can you post it again, sir. Thank you so much
@TigerSoft-um8ju
@TigerSoft-um8ju Год назад
Hi Nelson! Assalamualikum. Hope you're doing great. Nelson, Can you please give me this project's github link, if there is any?
@timango1399
@timango1399 4 месяца назад
how can i create securityConfig without extends WebSecurityConfigurerAdapter
@sush2142
@sush2142 2 года назад
Why isn’t the annotation on roles OneToMany? Shouldn’t it be one user with Many roles?
@dinobulja
@dinobulja Год назад
Lots of copy paste, fast scrolling/tab switching, duplication. Little of explanation but lots of reading what is in the code. Same like in the Spring Boot Angular video. But I guess, you will again tell me to shut up
@Bhushan1234able
@Bhushan1234able Год назад
It would have been great, if you could have added the reason behind each step or show a general flowchart of how authentication and authorization works. Like at 1.09.00 You added couple of classes for authentication, but how request is gonna traverse down this path and what was the motive of using this class, would have made a video better. Your contents are good no doubt, but some videos you just travel thru with no intention mentioned for each step.
@Lucas-iu8gd
@Lucas-iu8gd Год назад
How could i implement a 'remember me' based on JWT token and refresh_token. Should i determinate the TTL of refresh token like a year or something ?
@_phamtrung280
@_phamtrung280 Год назад
sooo.. i have a issue Reason: Failed to determine a suitable driver class.... it don't work with mySql for generate script database
@kunying4037
@kunying4037 2 года назад
Cool thank you so much
@Emerson-mv4hm
@Emerson-mv4hm 3 года назад
I would like to know if there is a better way of doing the path check inside the CustomAuthorizationFilter. Because in the security configuration you define which paths are authenticated, so maybe there is a way of excluding the CustomerAutorizationFilter for a specific case, like 'antMatcher("/api/login")'.
@rdogaldino04
@rdogaldino04 Год назад
Very nice, thanks for sharing your knowledge.
@berkslv
@berkslv Год назад
Is it good idea for enterprise to work with custom auth filter instead of protocols like OAuth2 provider services such as Keycloack?
@WaclawShuminski
@WaclawShuminski 2 года назад
OMG It's really great tutorial! Thank you man a lot! Also, we can place constant URLs such as "/login" or "/token/refresh" as static final fields in SecurityConfig and just use them wherever we want - in Filters, Resource Controllers, anywhere. And we just have to edit them once only at that point.
@kurtne4892
@kurtne4892 2 года назад
Good tip Constants are quite useful here.
@kubraozer6674
@kubraozer6674 Год назад
WebSecurityConfigurerAdapter is deprecated :( . I guess so the video is for old version of spring security
@juanmanueldesenzi1211
@juanmanueldesenzi1211 Год назад
Please upload the source code!!
Далее
Spring Security Architecture Explained
14:41
Просмотров 107 тыс.
▼ КАПИТАН НАШЁЛ НЕФТЬ В 🍑
33:40
Просмотров 442 тыс.
ХОККЕЙНАЯ КЛЮШКА ИЗ БУДУЩЕГО?
00:29
Шоколадная девочка
00:23
Просмотров 360 тыс.
What Is JWT and Why Should You Use JWT
14:53
Просмотров 1,2 млн
Here's The Secret How To Create These Animated Diagrams
11:12
Spring Security 6 with Spring Boot and JWT Tutorial
3:14:14
Java Data Structures Tutorial
1:39:50
Просмотров 338 тыс.
Spring Boot Roadmap - How To Master Spring Boot
17:42
Просмотров 423 тыс.
Spring Security: Spring Security + REST + JWT
1:52:13
Просмотров 46 тыс.
▼ КАПИТАН НАШЁЛ НЕФТЬ В 🍑
33:40
Просмотров 442 тыс.