Reputation: 984
I am trying to understand the ASP.NET policy-based authorization mechanism, and I understand that I need to do the following:
However, reading the ASP.NET documentation, I understand I might need to set up an IAuthorizationService as well. I failed to understand why that is needed from the ASP.NET documentation.
Do I have to set one up? What should it do? Is that an alternative to the policy and authorization handlers I am setting up or a required addition to them?
Upvotes: 3
Views: 1872
Reputation: 56
You can override IAuthorizationService
to take control of full authorization logic in your application.
By default, IAuthorizationService
is responsible for validation of Policy- Claim- or Role-based ruled, defined in AuthorizationOptions
.
IAuthorizationService
is usually being invoked in IAsyncAuthorizationFilter
(which MVC adds automatically once you mark Controller or Action with [Authorize]
attribute).
Upvotes: 3