Policy-based Authorization in ASP.Net Core (with Custom Authorization Handler)

  Рет қаралды 26,081

DotNet Core Central

DotNet Core Central

Күн бұрын

Пікірлер: 43
@justonegoodtrade
@justonegoodtrade 4 жыл бұрын
my friend, you saved my life with a current project. You're amazing
@DotNetCoreCentral
@DotNetCoreCentral 4 жыл бұрын
Glad I could help!
@sawairasana
@sawairasana Жыл бұрын
can you kindly tell me how to write authorization handler to keep user with same role i.e. user from editing or deleting each others records
@nickeax
@nickeax 3 жыл бұрын
Excellent lesson, thank you very much.
@DotNetCoreCentral
@DotNetCoreCentral 3 жыл бұрын
@Nick Fletcher, thanks for watching!
@xposedcadabiola.o111
@xposedcadabiola.o111 4 жыл бұрын
Excellent explanation. Thank you very much.
@DotNetCoreCentral
@DotNetCoreCentral 4 жыл бұрын
Thanks
@Yusuf07HD
@Yusuf07HD 4 жыл бұрын
great works! Keep it up.
@DotNetCoreCentral
@DotNetCoreCentral 4 жыл бұрын
Muhammad Eakub thank you!
@johnnguyen1655
@johnnguyen1655 4 жыл бұрын
Very good tutorial on the subject. Thanks very much
@DotNetCoreCentral
@DotNetCoreCentral 4 жыл бұрын
@@johnnguyen1655 Thanks!
@nuwan099
@nuwan099 8 ай бұрын
Great content! thank you!
@saurabhchauhan232
@saurabhchauhan232 4 жыл бұрын
Suggestion: Video for when to use Transient, Scoped and Singleton would be really helpful. (on you realworld project experience :) )
@DotNetCoreCentral
@DotNetCoreCentral 4 жыл бұрын
@Saurabh Chauhan, thanks for watching, and thanks for the suggestion!
@syneticsolutions344
@syneticsolutions344 Жыл бұрын
Great video, thanks!
@DotNetCoreCentral
@DotNetCoreCentral Жыл бұрын
Glad you liked it!
@ataaact9375
@ataaact9375 4 жыл бұрын
great vid. but unrelated question, what 's the name of the extension that you're using to get when the code was committed last and by whom?
@KunalMukherjee3701
@KunalMukherjee3701 3 жыл бұрын
It comes by default in visual studio pro and enterprise, it's called git blame
@ataaact9375
@ataaact9375 3 жыл бұрын
@@KunalMukherjee3701 aha that's why I don't have it, I use community. Thanks for the reply!
@OsamaALSHABANi
@OsamaALSHABANi 4 жыл бұрын
good vide , but i have question , what if my Roles are created on the running of the Application , it should not be hard coded here specially when you are using RequireRole function
@DotNetCoreCentral
@DotNetCoreCentral 4 жыл бұрын
@Osama ALSHABANi, thanks for watching! For your question, roles are usually decided as part of the requirement gathering process, not so much as a part of runtime code. But if you have a scenario where roles are created dynamically, in that case, you cannot use it this way for sure.
@yanchenru
@yanchenru 3 жыл бұрын
First of all, great video. Got a quick question, at 16:58, you replaced the previous policy "AdminAndPowerUser" with the new one "EmployeeWithMoreThan20Years". What if I want to keep the previous one as well, so a user who is an Admin but has worked less than 20 years can still have the access? Could you please help to explain how to implement that? Thanks very much.
@DotNetCoreCentral
@DotNetCoreCentral 3 жыл бұрын
@Chenru Yan, I am not 100% sure, I will have to try it out, but the easiest solution I can think of is creating a new policy to cover all the scenarios.
@yanchenru
@yanchenru 3 жыл бұрын
@@DotNetCoreCentral Thanks for your reply. For the new policy, does that mean a new handler will be created to check if the user belongs to Admin or PowerUser or has worked more than 20 years? That feels like repeating what already have been done in the other two policies. Just curious is possible in the Startup.cs file, do something such as options.AddPolicy("Combined", policy => policy.Add("AdminAndPowerUser", "EmployeeWithMoreThan20Years")); I am quite new to ASP.NET, please bear with all my naive questions.
@DotNetCoreCentral
@DotNetCoreCentral 3 жыл бұрын
@@yanchenru This post in stack overflow should help you with your requirement: stackoverflow.com/questions/35609632/asp-net-5-authorize-against-two-or-more-policies-or-combined-policy
@yanchenru
@yanchenru 3 жыл бұрын
@@DotNetCoreCentral Thank you for the information, it is very helpful.
@DotNetCoreCentral
@DotNetCoreCentral 3 жыл бұрын
@@yanchenru you are welcome!
@sav4384
@sav4384 3 жыл бұрын
how can we fetch roles from db and use in handler
@DotNetCoreCentral
@DotNetCoreCentral 3 жыл бұрын
@saveen gs, it should be just like any other place where you access the database. You do it from the middleware for authentication.
@sav4384
@sav4384 3 жыл бұрын
@@DotNetCoreCentral thankq
@yogeswarank
@yogeswarank 3 жыл бұрын
Thank you very much. Can you also make a video on how to change the user claim after the user is logged in. Need a flexibility to refresh the claims of the user without asking him to log out and login again.
@DotNetCoreCentral
@DotNetCoreCentral 3 жыл бұрын
@yoges waran, thanks for watching the video! If I understand your requirement correctly, what you are looking for is the refresh token implementation. I have done a video on the same here: kzbin.info/www/bejne/bXuzaIlrbr1kqc0 Please take a look and let me know if this serves your purpose.
@elioscipioni8908
@elioscipioni8908 3 жыл бұрын
thanks for sharing, great video!!
@DotNetCoreCentral
@DotNetCoreCentral 3 жыл бұрын
@Elio Scipioni, thanks for watching!
@trinhnv1205
@trinhnv1205 3 жыл бұрын
very helpful
@DotNetCoreCentral
@DotNetCoreCentral 3 жыл бұрын
@Nguyễn Văn Trình, thanks for watching!
@karenj5880
@karenj5880 4 жыл бұрын
Thank you!
@DotNetCoreCentral
@DotNetCoreCentral 4 жыл бұрын
@Karen D, thanks for watching!
@karenj5880
@karenj5880 4 жыл бұрын
@@DotNetCoreCentral It was very straight forward and to the point, answered exactly what I was looking for!
@DotNetCoreCentral
@DotNetCoreCentral 4 жыл бұрын
@@karenj5880 glad this video could help!
@genotypek6133
@genotypek6133 3 жыл бұрын
My friend it's authorization not authentication. You can authenticate yourself with bearer token, cookie etc. - just to tell who you are. You can authorize yourself with policies or roles - check if you're allowed to do something.
@giampaolotucci5897
@giampaolotucci5897 3 жыл бұрын
Really tnx
@DotNetCoreCentral
@DotNetCoreCentral 3 жыл бұрын
@Giampaolo TUCCI, thanks for watching!
JWT Refresh Token in ASP.Net Core (a deep dive)
33:13
DotNet Core Central
Рет қаралды 30 М.
UFC 287 : Перейра VS Адесанья 2
6:02
Setanta Sports UFC
Рет қаралды 486 М.
🎈🎈🎈😲 #tiktok #shorts
0:28
Byungari 병아리언니
Рет қаралды 4,5 МЛН
КОНЦЕРТЫ:  2 сезон | 1 выпуск | Камызяки
46:36
ТНТ Смотри еще!
Рет қаралды 3,7 МЛН
Как Ходили родители в ШКОЛУ!
0:49
Family Box
Рет қаралды 2,3 МЛН
Basic Auth: Roles, Policy, Claims (ASP.Net Core Stuff You Need To Know)
20:19
Just Blazor Programming
Рет қаралды 7 М.
Authorization in ASP NET Core
12:27
kudvenkat
Рет қаралды 169 М.
This open problem taught me what topology is
27:26
3Blue1Brown
Рет қаралды 542 М.
How to use Middleware in ASP.NET Core (2 ways of implementing middleware)
17:59
ASP.NET Core - Roles vs Claims vs Policy
23:11
Raw Coding
Рет қаралды 99 М.
DID YOU NOTICE ANY LAPSES IN THE VIDEO or NOT? / MARGO_FLURY
0:34
MARGO FLURY | Маргарита Дьяченкова
Рет қаралды 12 МЛН
Do YOU Understand WHAT JUST HAPPENED!? 😂 #shorts
0:57
LankyBox World
Рет қаралды 1,6 МЛН
Самые простые строительные леса
0:54
Канал ИДЕЙ
Рет қаралды 1 МЛН
(✋❌)kageihina VS siajiwoo VS meosimmyyt VS oxzung#tiktok #shorts
0:12
SH - Anh trai & Em gái || Brother & Sister #shorts
0:58
Su Hao
Рет қаралды 48 МЛН
Заставила парня продать зажигалки
0:52
Жизнь Барахольщика
Рет қаралды 3,3 МЛН