In my Azure Web App I want to impersonate the user by using their ClaimsIdentity to call a 3rd party API. The 3rd party web API allows Basic or Kerberos, optionally I can switch to the 3rd party SDK which uses windows integrated security if neccessary.
The problem I'm running into is the impersonation bit, below is my code as it is.
var webUser = HttpContext.Current.User.Identity as ClaimsIdentity;
var windowsIdentity = S4UClient.UpnLogon(webUser.Claims.FirstOrDefault(x => x.Type.Equals(ClaimTypes.Upn)).Value);
using (var impersonationContext = windowsIdentity.Impersonate())
{
//make call to 3rd party Web API or SDK
}
When running the above I get the following error:
The pipe endpoint 'net.pipe://localhost/s4u/022694f3-9fbd-422b-b4b2-312e25dae2a2' could not be found on your local machine.
Everything I've read points to starting the C2WTS windows service, is there a way to start this service for an Azure web app? If not how can I go about impersonating the user or passing credentials to my 3rd party api/sdk?