I’m adding some Web API services to an existing MVC application. I have a model binder for my MVC controllers to get the user object stored in a CustomIdentity. I’m trying to reproduce this for my Web API actions.
In the MVC Controller or its binders I can use
controllerContext.HttpContext.User.Identity
The ApiController doesn’t have the HttpContext object. Is there anyway to access the IIdentity object from the Web API?
They removed GetUserPrincipal in ASP.NET MVC 4 RC. However it seems the ApiController property User has replaced this: http://msdn.microsoft.com/en-us/library/system.web.http.apicontroller.user