Set Thread.CurrentPrincipal to Owin

Is there a good way to customize my user Principal to allow business logic to get complete information about the user who requested the web api?

I tried these:

  • Setting Thread.CurrentPrincipal in MessageHandler is overridden, and later in ApiController I get ClaimsPrincipal, installed my Owin middleware
  • Creating BaseController: ApiController and trying to set Thread.CurrentPrincipal to ExecuteAsync did not work because I always get Request.GetOwinContext.Authentication.User ..... IsAuthenticated = false, although later in the call to the ApiController method ClaimsIdentity is set again
+4
source share

All Articles