1
public class HMACAuthenticationAttribute : Attribute, IAsyncAuthorizationFilter
{
   public HMACAuthenticationAttribute(IUser user)  
   {
     .....
   }
}

The above is my class attribute. I want to call this in below controller.Is there any way to call the above class.

[HMACAuthentication()]
public class WeatherForecastController : ControllerBase
{
}
TylerH
  • 20,799
  • 66
  • 75
  • 101
Akhil Bajjuri
  • 15
  • 1
  • 7
  • Check out this answer https://stackoverflow.com/questions/4102138/how-to-use-dependency-injection-with-an-attribute – Yngvarr Dec 18 '19 at 20:58
  • I'm able to pass the strings as param but i'm unable to pass the instance of interface as param. – Akhil Bajjuri Dec 19 '19 at 05:37
  • https://stackoverflow.com/questions/59404594/how-to-call-attribute-which-is-having-parameterinterface-in-constructor-from-c follow this link.We will get the answer easly. – Akhil Bajjuri Dec 19 '19 at 08:26

0 Answers0