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.
Working with authorization handlers - ASP.NET Core Tutorial
From the course: ASP.NET Core Identity: Authorization Management
Working with authorization handlers
- [Instructor] On the last part we learned how to create a custom requirement class, and on this part we are going to learn how to check the requirements, and to check the requirements we are going to use the Authorization Handlers, an Authorization Handler is responsible for evaluating the requirements properties, and the Authorization Handler evaluates the requirements against a provided Authorization Handler Context. To determine if access is allowed or not, now let us to go our project and see how we can create a handler, register the handler and then use this handler in the controller. In Visual Studio go to Solution Explorer, then inside the Helpers class we are going to create our handler, so add a class. We are going to name this handler, the MinimumAgeHandler and then click the Add button to create this class. To create a handler we need to inherit from the AuthorizationHandler base class. So write in here AuthorizationHandler and we pass as a parameter our custom…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.