From the course: ASP.NET Core Identity: Authorization Management

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Authorization policy requirements

Authorization policy requirements - ASP.NET Core Tutorial

From the course: ASP.NET Core Identity: Authorization Management

Start my 1-month free trial

Authorization policy requirements

- [Instructor] We have learned so far about simple authorization, role or claims-based authorization. But not all authentication scenarios that we might need to implement in our applications fit to these models. But in .NET Core, we can build our own authorization requirements and handlers that work with the policy model. Let's suppose in our school, there is a chess game competition, but with an age restriction. Only students that are older than 15 years old can take part. So, in this case, we need to create a minimum age requirement and create the necessary handlers to check if this requirement is met. Now, let us go to Visual Studio and start implementing the policy-based authorization. On Visual Studio, go to Solution Explorer, and then right click on the Controllers, because we need to create a new controller. Since this controller is going to be about the game competition, let us name this controller GameController, and then click the Add button to create this controller. We see…

Contents