I'm working on an ASP.NET web application that uses Web API 2 and Unity. We've decorated our controllers/controller methods with a subclass of the built-in System.Web.Http.AuthorizeAttribute to apply authorization for our various REST endpoints exposed by Web API.
We would like to be able to inject dependencies into this attribute using Unity. I've done quite a bit of searching, but most examples are just different enough from my use case to not be useful.
How do I go about injecting dependencies into my System.Web.Http.AuthorizeAttribute subclass using Unity?
I've tried creating a custom FilterProvider that calls Unity's BuildUp
method on the attribute instance, but I'm not sure which base class I should be extending or interface I should be implementing.