In an existing ASP.NET web application with the Identity Provider, using Forms Authentication, I'd like to authenticate a WCF AJAX Enabled Web Service using the user's already provided logon credentials for the site.
i.e. the WCF web service is only authenticated if the user has passed authentication for the forms website. No further authentication would be necessary for the WCF web service since it is hosted on the same web application.
The check if the user is authenticated would use the Identity framework code like
bool isUserAuthenticated= (System.Web.HttpContext.Current.User != null) && System.Web.HttpContext.Current.User.Identity.IsAuthenticated
from How to check user is "logged in"?
The server-service code should be able to get the user's username from
System.Web.HttpContext.Current.User.Identity.GetUserId()
from ASP.NET MVC 5 - Identity. How to get current ApplicationUser
The context for a WCF web service is OperationContext, not HttpContext.