views:

220

answers:

1

I have a ASP.NET MVC page, which call WCF logic.

The system is single-signon using NTML. Both the ASP page and the WCF will use the UserIdentity to get user login information.

Other then NTML, I will also have a Form based authorization (with AD) in same system.

The ASP page, is it simple and I can have it from HttpContext.Current.Request.LogonUserIdentity.

However, it seem it is missing from the WCF which call by the ASP, not from browser.

How to configure to pass the ID pass from the ASP to the WCF?

A: 

It sounds to me like you need to perform 'Impersonation' of the original user which will allow you to pass on the original caller's identity to the WCF service.

See this guide: Impersonation and Delegation in WCF

Although you have configured ASP.NET to authenticate your callers via NTLM, the worker process is still running with a machine identity (depending on your configuration in IIS). You would need to explicitly impersonate the caller by having the process adopt the callers identity, perhaps just temporarily.

UPDATE: see also Delegation - WCF Gotcha #2

If you want to avoid impersonation anothe option is to use the IdentityModel and a WindowsClaimSet

rohancragg
I've thought about Impersonation, but I not really need it.Everything should run from a safe system account, and what I need is the person's SID.I am start thinking of passing it via parameter.
Dennis Cheung
If you look at the code sample in my second link you only need to impersonate for the duration of a using block. But I take your point. However, I would not pass it as a parameter unless you plan on encrypting the data. I do think you need to use Delegation. See the additional link in the updated answer text.
rohancragg