Secure Your .NET API in 15 Minutes: JWT Authentication Tutorial

  Рет қаралды 18,397

Milan Jovanović

Milan Jovanović

Күн бұрын

Пікірлер: 72
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
Do you want to simplify your development process? Grab my free Clean Architecture template here: bit.ly/3Andaly
@BeijoVegan
@BeijoVegan 2 ай бұрын
Can I make a suggestion? Please, use some kind of editing software that zoom in where you click with the mouse. It's very hard to follow your coding on mobile phones.
@19balazs86
@19balazs86 2 ай бұрын
JWT is a nice topic, and I can not wait for the continuation of Keycloak.
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
It's scheduled for next Friday :)
@pranikpratik
@pranikpratik 2 ай бұрын
You sound calm now. It’s great content, Keep it up.
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
It varies based on how many coffees I had prior ☕☕
@shanabunny
@shanabunny 2 ай бұрын
I was just about to implement it. Perfect timing thank you.
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
Perfect! 😁
@iq4u213
@iq4u213 2 ай бұрын
Awesome video ! next video should be about Refresh Token
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
Good idea, actually!
@enricoroselino7557
@enricoroselino7557 2 ай бұрын
great video as always, do you have any tips on implementing role based access control using jwt ? or i shouldnt implement it inside jwt in the first place ?
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
You can add the roles as claims on the JWT, it's pretty simple. You then use these claims to implement an authorization policy.
@ukgames304d
@ukgames304d 2 ай бұрын
please Milan make a video about implementing refresh token :)
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
All right, all right
@Credi6464
@Credi6464 2 ай бұрын
Pure gold content! Thanks for that!
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
Glad it was helpful!
@EzequielRegaldo
@EzequielRegaldo 2 ай бұрын
Awesome, your tutorials are the best !
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
Thanks a lot!
@vbachris
@vbachris 2 ай бұрын
2 added bonus material? 1) token refresh 2) in conjunction with EntraID
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
Good suggestions for future videos
@isahirzm
@isahirzm 2 ай бұрын
Great tutorial, when it comes to consume the API, what would be the best practices to do on the consumer(front-end)
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
As in where to store the JWT?
@isahirzm
@isahirzm 2 ай бұрын
@@MilanJovanovicTech yes
@asesorwebvideos
@asesorwebvideos 2 ай бұрын
gracias saludos desde CHILE
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
Many thanks!
@s.a.h.i1261
@s.a.h.i1261 Ай бұрын
Would love to see a video on how to protect this system additionally from CSRF attacks
@MilanJovanovicTech
@MilanJovanovicTech Ай бұрын
Good suggestion
@ALOKSHARMAMD
@ALOKSHARMAMD 2 ай бұрын
do you have any videos explaining tools like open telemetry, application insights, grafana etc with dotnet. i have been going through different tools to implement in-app profiler for potential memory leaks handling and its very confusing on what to choose to identify & record basic memory/cpu usage for leaks and exceptions etc. As application insight is Azure specific, and other tools are not so easy to add by top attribute. any suggestions which doesn't rely on cloud deployments?
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
Check out the OpenTelemetry video here: kzbin.info/www/bejne/fqO1o31rrLmnms0 You should be able to use the metrics in Aspire to gain some insights
@Arshaad786000
@Arshaad786000 2 ай бұрын
this is brilliant. can you show us how to implement something like this with microsoft identity and roles
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
Will do
@davidespada01
@davidespada01 2 ай бұрын
thank you can you show us how to consume the JWT token with validating
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
What do you mean by this?
@EzequielRegaldo
@EzequielRegaldo 2 ай бұрын
When you use Auth required in some route its automatically validated. Library does it for you
@EzequielRegaldo
@EzequielRegaldo 2 ай бұрын
@@MilanJovanovicTech maybe caducation or refreshing
@davidespada01
@davidespada01 2 ай бұрын
@@MilanJovanovicTech sorry i was not clear, i meant if i have an api application that will get jwt from other application and use it for further api calls what if i need to validate that jwt 1st in case it was encrypted Thank you ,, your amazing
@WangAndrew
@WangAndrew 2 ай бұрын
how do you validate the jwt token on the client side, if blazor wasm ?
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
I believe you'd need the key to verify the hash, which isn't ideal. But if you just want to parse the content, that's not as hard.
@WangAndrew
@WangAndrew 2 ай бұрын
@@MilanJovanovicTech what if the server side use ‘asymmetric’ then the client side only need the public key not the private key
@abdullahm.3363
@abdullahm.3363 2 ай бұрын
Great video, how to create a refresh token, so the user don't have to login again and again.
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
You can use a similar approach to here. Just store the refresh token in the DB, and give it a longer lifetime. Then expose an endpoint to send the refresh token in exchange for a new access token.
@Mo-ef9yt
@Mo-ef9yt 2 ай бұрын
Thanks​@@MilanJovanovicTech
@agusbudianto4473
@agusbudianto4473 2 ай бұрын
Hi Milan, how to integrate this JWT token with SignInManager in Identitiy Core
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
Use SignInManager to verify password, and then generate a JWT and return it
@theeusftn
@theeusftn 2 ай бұрын
can you teach how to make hmac authentication?
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
Sure
@denisgudiel5574
@denisgudiel5574 2 ай бұрын
Is the Manger user secrets more secure than the appsettings?
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
I didn't quite understand you there
@denisgudiel5574
@denisgudiel5574 2 ай бұрын
@@MilanJovanovicTech is that you use the "Manager user secrets" to save the jwt key
@VishalYadav-oq9if
@VishalYadav-oq9if 2 ай бұрын
Awesome 👍
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
Thank you! Cheers!
@omidkianifar5144
@omidkianifar5144 2 ай бұрын
Continue Keycloak series plz
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
Next week (schedueld for Friday)
@omidkianifar5144
@omidkianifar5144 2 ай бұрын
@@MilanJovanovicTech 😍
@dhmilmile1
@dhmilmile1 2 ай бұрын
How can we implement refresh token?
@istovall2624
@istovall2624 2 ай бұрын
Do the same thing bit set the refresh token lifespan to longer then send them both. when the jwt expires resubmit them both to reissue. Still validate the jwt but make sure the only part invalid is the expires. Validate the refresh token. If valid and not expired, reissue new jwt.
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
There you go 😁
@ojhkhofdgfd
@ojhkhofdgfd 2 ай бұрын
@@MilanJovanovicTech That's a great video! I believe you mentioned it is possible to somehow use the refresh token generated by AddIdentityApiEndpoints Service login endpoint to refresh JWTs?
@dhmilmile1
@dhmilmile1 2 ай бұрын
@@istovall2624 got it thanks
@MahmoudSaed98
@MahmoudSaed98 18 күн бұрын
Milan please we want a video about Refresh Token
@MilanJovanovicTech
@MilanJovanovicTech 18 күн бұрын
Recorded, releasing soon
@MahmoudSaed98
@MahmoudSaed98 17 күн бұрын
@@MilanJovanovicTech Thank you very much
@СтасСеверин-н9й
@СтасСеверин-н9й 2 ай бұрын
Where can i download this code?
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
This code on www.patreon.com/milanjovanovic But also try this :) www.milanjovanovic.tech/templates/clean-architecture
@АлексейАнтонов-ф5ш
@АлексейАнтонов-ф5ш 2 ай бұрын
Do something about external signin, like facebook, google, etc.
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
Good suggestions
@RicusNortje
@RicusNortje 2 ай бұрын
Now you don't even need to pass in the user ID on the get user endpoint as you can get it from the JWT subject
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
Yes!
@tumers.1595
@tumers.1595 Ай бұрын
Good tutorial. But it seems to write all the codes into memory. It seems unrealistic and insincere to me.
@MilanJovanovicTech
@MilanJovanovicTech Ай бұрын
Which part?
Secure Your .NET Application With Keycloak: Step-by-Step Guide
17:05
Milan Jovanović
Рет қаралды 18 М.
Session Vs JWT: The Differences You May Not Know!
7:00
ByteByteGo
Рет қаралды 236 М.
Players vs Pitch 🤯
00:26
LE FOOT EN VIDÉO
Рет қаралды 96 МЛН
Trick-or-Treating in a Rush. Part 2
00:37
Daniel LaBelle
Рет қаралды 38 МЛН
Amazing remote control#devil  #lilith #funny #shorts
00:30
Devil Lilith
Рет қаралды 12 МЛН
Are You Accidentally Crippling Your EF Core Queries?
17:18
Milan Jovanović
Рет қаралды 29 М.
The Logging Everyone Should Be Using in .NET
15:34
Nick Chapsas
Рет қаралды 80 М.
Coding Was HARD Until I Learned These 5 Things...
8:34
Elsa Scola
Рет қаралды 642 М.
Implementing JWT Authentication in ASP.NET Core
23:51
Nick Chapsas
Рет қаралды 36 М.
How To Build Feature Flags Like A Senior Dev In 20 Minutes
20:33
Web Dev Simplified
Рет қаралды 79 М.