开发者

ASP.NET with WCF Windows Authentication

We have ASP.NET application which uses Windows integrated authentication. We would like to use the same windows authentication with our WCF service. Our ASP.NET is using the Windows Kerobros authentication. Is there any way we can leverage the same windows token for WCF service atuthitication.

Is it l开发者_如何学Goike configure the WCF with windows authenication and the same groups configure their. I would like to do something like Single Sign On type of implementation.

i am assumeing it will be like impersionation the current user and call the WCF call.


If I'm understanding you correctly (and please excuse me if I don't, it's getting late by my count), you should be able to play with enabling Windows authentication on WCF then configure your client to pass the credentials on:

  • system.serviceModel
    • behaviors
      • endpointBehaviors
        • behavior
          • clientCredentials
            • windows

And set the allowedImpersonationLevel attribute to Delegation or Impersonation (depending your needs) [see also]

...or I'm off base (In which case it's time for me to go to bed. My apologies & feel free to ignore this answer)


Here is the sample code which will help you.
Code will wile take the windows authentication token from ASP.Net application and pass to the WCF service:


ServiceReference1.Service1Client _testserviceclient = new ServiceReference1.Service1Client();
_testserviceclient.ClientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜