- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
Role-based Authorization in ASP.Net Core (With Custom Authentication Handler)
In this video, I am going to take a deep-dive into ASP.Net Core role-based Authorization. Authorization is the process to find out what action a user can perform. In the case of a REST API, it can be the resources a user can access. Or a particular HTTP verb associated with a resource.
For example, let us say we have an e-commerce inventory management application. In the application, the warehouse manager manages the record of the entire inventory of the warehouse. And let us say that there is a REST API for Inventory. Also, the API exposes GET to return all items in the inventory. Plus a POST to add items to the inventory. In this case, the warehouse manager with administrative privilege will be able to access both the GET and POST methods of the Inventory resource. Whereas a warehouse employee will be able to access only the GET method of the Inventory resource.
For authorization to work, the user has to be authenticated first. This is something I discussed in my previous two videos on authentication. To find out what a user can access we need the user's identity. And the identity of an user is set only after the user is authenticated.
To understand the code examples here and how it ties with authentication I strongly suggest to view my previous two videos on Authentication.
https://youtu.be/6Go46VRs7hI
https://youtu.be/vWkPdurauaA
In role-based authorization, checks are done with an attribute-based declaration. We will use AuthorizeAttribute attribute in the method which we want to allow access to a specific role. And the role is identified from the Identity of a user.
Видео Role-based Authorization in ASP.Net Core (With Custom Authentication Handler) канала DotNet Core Central
For example, let us say we have an e-commerce inventory management application. In the application, the warehouse manager manages the record of the entire inventory of the warehouse. And let us say that there is a REST API for Inventory. Also, the API exposes GET to return all items in the inventory. Plus a POST to add items to the inventory. In this case, the warehouse manager with administrative privilege will be able to access both the GET and POST methods of the Inventory resource. Whereas a warehouse employee will be able to access only the GET method of the Inventory resource.
For authorization to work, the user has to be authenticated first. This is something I discussed in my previous two videos on authentication. To find out what a user can access we need the user's identity. And the identity of an user is set only after the user is authenticated.
To understand the code examples here and how it ties with authentication I strongly suggest to view my previous two videos on Authentication.
https://youtu.be/6Go46VRs7hI
https://youtu.be/vWkPdurauaA
In role-based authorization, checks are done with an attribute-based declaration. We will use AuthorizeAttribute attribute in the method which we want to allow access to a specific role. And the role is identified from the Identity of a user.
Видео Role-based Authorization in ASP.Net Core (With Custom Authentication Handler) канала DotNet Core Central
Комментарии отсутствуют
Информация о видео
13 января 2020 г. 2:56:03
00:12:40
Другие видео канала


![An introduction to FusionCache [.NET 8]](https://i.ytimg.com/vi/-ijPI53-mdA/default.jpg)


![Extension Methods (An Introduction for .NET Developers [.NET 5 and C#])](https://i.ytimg.com/vi/v_cgQzp8YHQ/default.jpg)
![Memento Design Pattern (An Introduction for .NET Developers [.NET 6 and C# 10])](https://i.ytimg.com/vi/G82F85SqYUs/default.jpg)





![OpenTelemetry with Semantic Kernel AI Agent in ASP.NET Web API [C#/.NET]](https://i.ytimg.com/vi/kLfGLC__onA/default.jpg)
![How to pass test parameters to MSTest methods [C# 11/.NET 7]](https://i.ytimg.com/vi/XFn-rQ-C2Cg/default.jpg)







![Class, Constructor, Function, and Property in C# [C# Fundamental series, examples in .NET 6 ]](https://i.ytimg.com/vi/RpuuThqrKmY/default.jpg)