开发者

ASP.NET with WCF Windows Authentication

开发者 https://www.devze.com 2023-02-04 16:18 出处:网络
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 authentic

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

精彩评论

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

关注公众号