How to integrate SAML authentication into WCF web service application

前端 未结 2 1873
情歌与酒
情歌与酒 2021-02-09 04:52

I have a WCF web service application built and tested on IIS7. Regarding authentication I wanted to implement a sql server hosted userd id and password authentication for consum

2条回答
  •  半阙折子戏
    2021-02-09 05:02

    Since 2011, support for Claims-Aware WCF Services has apparently improved with the release of .NET 4.5. I'll copy info from that article in case it ever changes, but as of the time of this answer, the process appeared to be as simple as:

    1. Adding a reference to WIF (Microsoft.IdentityModel.dll) in your WCF Service project. Since this is delivered with .NET 4.5, I do not believe a NuGet package is necessary.

    2. Use the following code sample to create a self-hosted Claims-Aware service:

      var host = new ServiceHost(typeof(ClaimsAwareWebService), new Uri("myUri")); FederatedServiceCredentials.ConfigureServiceHost(host);

      host.Open();

    3. Set your WCF service to use the federatedServiceHostConfiguration Behavior Extension.

提交回复
热议问题