Host custom WCF-service with authentication within Umbraco
Hi There
I've created a custom WCF-service within Umbraco. The service resides in the Service-folder and seems to be working fine (I can call it and it responds appropriately). Now I want the users to authenticate themselves when they call the service.
When my service is called it should use the Umbraco membership provider to authenticate the users.
My client specificies this by creating a network cridential object, like this:
var a = new RaceEntities(new Uri("http://localhost:40406/umbraco/Webservices/RaceManDataService.svc")) { Credentials = new NetworkCredential("admin", "secret") };
When I inspect the HTTPContext.Current I don't see any authenticated users. What am I doing wrong?
Host custom WCF-service with authentication within Umbraco
Hi There
I've created a custom WCF-service within Umbraco. The service resides in the Service-folder and seems to be working fine (I can call it and it responds appropriately). Now I want the users to authenticate themselves when they call the service.
To do this i've put in this into the web.config:
When my service is called it should use the Umbraco membership provider to authenticate the users.
My client specificies this by creating a network cridential object, like this:
When I inspect the HTTPContext.Current I don't see any authenticated users. What am I doing wrong?
- Frederik
I've kinda solved it.
I've enabled authentication sever (se this article: http://msdn.microsoft.com/en-us/library/bb398990(v=vs.100).aspx).
I have extended global.asax to use the umbraco membership provider (see this article: http://msdn.microsoft.com/en-us/library/bb386455(v=vs.90).aspx)
To get the cookie from the WCF-call (you cannot get that directly in WCF because cookie are transparent in WCF) I followed this article:http://megakemp.com/2009/02/06/managing-shared-cookies-in-wcf/
Now I want to send the same cookie to my WCF-service on every call I did something like this (extended my entity class with a partial implementation): http://blogs.msdn.com/b/astoriateam/archive/2010/07/21/odata-and-authentication-part-7-forms-authentication.aspx
If I turn on asp.net compability in web.config I am now able to access the callers membership through: HttpContext.Current.User.Identity.Name
- Frederik
is working on a reply...