
Text version of the video
https://csharp-video-tutorials.blogsp...
Slides
https://csharp-video-tutorials.blogsp...
ASP.NET Core Text Articles & Slides
https://csharp-video-tutorials.blogsp...
ASP.NET Core Tutorial
https://www.youtube.com/playlist?list...
Angular, JavaScript, jQuery, Dot Net & SQL Playlists
https://www.youtube.com/user/kudvenka...
Authentication and Authorization in ASP.NET Core
Authentication is the process of identifying who the user is.
Authorization is the process of identifying what the user can and cannot do.
Authorization in ASP.NET Core MVC is controlled through the AuthorizeAttribute
ASP.NET Core Simple Authorization
When the Authorize attribute is used in it's simplest form, without any parameters, it only checks if the user is authenticated. This is also called simple authorization.
[Authorize]
public class SomeController : Controller
{
}
We discussed simple authorization in detail in Part 71 of ASP.NET Core tutorial.
Role Based Authorization in ASP.NET Core
Role-based authorization checks can be applied either against a controller or an action within a controller.
Role Based Authorization Example
Only those users who are members of the Administrator role can access the actions in the AdministrationController
[Authorize(Roles = "Administrator")]
public class AdministrationController : Controller
{
}
Multiple Roles Example
Multiple roles can be specified by separating them with a comma. The actions in this controller are accessible only to those users who are members of either Administrator or User role.
[Authorize(Roles = "Administrator,User")]
public class AdministrationController : Controller
{
}
Multiple Instances of Authorize Attribute
To be able to access the actions in this controller, users have to be members of both - the Administrator role and the User role.
[Authorize(Roles = "Administrator")]
[Authorize(Roles = "User")]
public class AdministrationController : Controller
{
}
Role Based Authorization Check on a Controller Action
Members of the Administrator role or the User role can access the controller and the ABC action, but only members of the Administrator role can access the XYZ action. The action Anyone() can be accessed by anyone inlcuding the anonymous users as it is decorated with AllowAnonymous attribute.
[Authorize(Roles = "Administrator, User")]
public class AdministrationController : Controller
{ public ActionResult ABC() { } [Authorize(Roles = "Administrator")] public ActionResult XYZ() { } [AllowAnonymous] public ActionResult Anyone() { }
}
asp.net core docker ASP NET Core role based authorization | |
122 Likes | 122 Dislikes |
7,983 views views | 524K followers |
Science & Technology | Upload TimePublished on 23 Jul 2019 |
Related keywords
ajax meaning,central park 5,asp.net core github,craigslist nj,asp.net core 3,server status,ajax fc,ajax players,server jobs nyc,asp.net core swagger,credit karma,mvc design pattern,asp.net machine account,server error in '/' application,servers for minecraft,asp.net core dependency injection,asp.net core 3.0,calculator,ajax ontario,asp.net mvc tutorial,asp.net core 3 release date,server job description,asp.net cos'è,mvc hours,asp.net core web api,ajax jquery,craigslist ny,ajax call,asp.net core 2. guida completa per lo sviluppatore,asp.net core,server pro,server status ffxiv,asp.net zero,cheap flights,server memes,asp.net core hosting,chase,serverless architecture,server resume,server books,mvcc connect,college football,ajax deadpool,server jobs,cvs,cnn,mvc tutorial,costco hours,asp.net web api,server side rendering,serverless,mvc nj,asp.net core download,cool math games,citibank,asp.net core identity,ajax parking,asp.net core logging,mvconnect,cunyfirst,ajax post,asp.net guida,ajax jersey,asp.net core razor pages,server duties,asp.net core environment variables,http://asp.net,server 2019,chernobyl,century 21,serverminer,ajax cleaner,mvcsd,mvcsc,asp.net core configuration,ajax marvel,asp.net tutorial,asp.net mvc,mvc medical,asp.net core tutorial,ajax roster,mvc architecture,mvc2,asp.net core mvc,ajax soccer,chase online,server hosting,costco,server jobs near me,ajax dish soap,capital one,server rack,craigslist,ajax tavern,ajax javascript,ajax request,asp.net core 2.2,asp.net core signalr,mvc framework,ajax paving,mvc near me,ajax greek,mvc pattern,asp.net identity,mvcu,asp.net core middleware,mvc map,asp.net download,mvc webadvisor,mvcc,mvci,mvctc,
Không có nhận xét nào:
Đăng nhận xét