Authentication Filters in ASP.NET Web API 2

Authentication filters let you set an authentication scheme for individual controllers or actions. In this way, your app can support various authentication mechanisms for different HTTP resources. Like other filters, authentication filters can be applied per-controller, per-action, or globally to all Web API controllers.

To apply the authentication filter to a controller, decorate the controller class with the filter attribute. The code sets the IdentityBasicAuthentication] filter on a controller class, which enables Basic Authentication for all of the controller’s actions.

In this article, the sample shows an authentication filter that implements the HTTP Basic Access Authentication scheme.

Read the rest of the tutorial here:

Leave a Reply

Your email address will not be published. Required fields are marked *