April 2017
Intermediate to advanced
564 pages
24h 7m
English
Declarative authorization is executed before the controller or action method is executed, whereas sometimes it is needed to load the controllers or actions before the authorization is executed, and this can be done using imperative authorization or resource-based authorization. Let's take an example of university courses, where we need to show the course page to only those students who have paid their course fees.
To implement this authorization, we first have to add the overloaded constructor in our Course controller, as follows:
public class CourseController : Controller { IAuthorizationService _authorizationService = null; public CourseController(IAuthorizationService authorizationService) { Read now
Unlock full access