We are developing a website that uses the repository template / unit of work. We use Autofac to help create objects between these levels of abstraction.
I wrote an AutoFac authentication filter that currently captures Basic Auth headers and creates an IPrincipal object and assigns it to HttpContext.Current.User
In our usual DbContext class, I want Autofac to get a copy of this IPrinipal object without looking at System.Web.HttpContext (to save this decoupling)
Does anyone have any hints on how I can get AutoFac to grab this IPrincipal and inject it into my custom DbContext class with every web API call?
Any help is appreciated
source share