Reputation:
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:
Everything works nicely when using wsHTTPBinding. However to get JSON working I have 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:
<webHttpBinding>
<binding name="AjaxBinding">
<security mode="None">
<transport clientCredentialType="Ntlm" />
</security>
</binding>
</webHttpBinding>
<endpoint name="DataJson" address="Datajson" binding="webHttpBinding"
bindingConfiguration="AjaxBinding"
behaviorConfiguration="jsonbehaviour" contract="MyContract"/>
<behavior name="jsonbehaviour">
<!--<webHttp/>-->
<enableWebScript/>
</behavior>
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 in case of multiple identities that I read about:
<deny users="?"/>
Any ideas anyone?
Upvotes: 3
Views: 4952
Reputation: 1759
Do you have this section in your config?
<system.web>
<identity impersonate="true"/>
These are the only things that I have on my "list" of things to check when doind integrated authentication, that you did not explicitly mention in your question. Hope it helps?
Upvotes: 1