Hope someone can help!
I am calling a WCF service using JSON but I am not able to get the user credentials out.
We are using Kerberos so IIS is setup as the following:
Server-side tasks:
- IIS server is member of domain
- Set IIS server computer account in AD Users & Computers MMC as "Trusted for Delegation"
- IIS Server must be rebooted for this policy to take effect.
- Integrated Windows Authentication only must be selected for site / virtual directory
- IIS must not have NTLM only set as authentication method (this is usually not a problem, NEGOTIATE is default, so unless you specifically ran a script to change this, don't worry about it).
- IIS server name either must match exactly account name in AD, or SetSPN tool should be used in cases where IIS site is set as alternative name (e.g. server is called server01.domain.com, and website is called www.application.com).
Client-side tasks
- Client must be using IE 5.x+. If client is running IE 6, ensure that "Enable Integrated Windows Authentication (requires restart)" is selected from Tools > Internet Options > Advanced.
- Web site MUST be recognized as Local Intranet (not Internet Zone) site to client. I have not seen any documentation explaining why, but I just have never been able to get it to work otherwise. If necessary, specifically add this to Local Intranet sites list.
- Client account must not be marked as "Sensitive, Do not Delegate" in AD Users and Computers MMC.
Everything works nicely when using wsHTTPBinding. However to get JSON working i am having to use WebHttpBinding. I then need to get the user credentials out so i can use impersonation to talk to the backend services.
My binding in the WFC config is as below: I used http://underground.infovark.com/2008/03/21/wcf-webhttp-binding-and-authentication/ to help < binding name="AjaxBinding"> transport clientCredentialType="Ntlm" />
<endpoint name="DataJson" address="Datajson" binding="webHttpBinding" bindingConfiguration="AjaxBinding" behaviorConfiguration="jsonbehaviour" contract="MyContract"/>
-->
It is calling the WCF service successfully but I am unable to get anything from: HttpContext.Current.User.Identity OR ServiceSecurityContext.Current.WindowsIdentity
other than anonymous so i am unable to do:
WindowsIdentity identity = (WindowsIdentity)HttpContext.Current.User.Identity();
using (identity.Impersonate())
{
// ... code to call application B goes here ...
}
I have tried adding this into the web config incase of multiple identities that i read about:
<deny users="?"/>
Any ideas anyone?