Developing with .NET 3.5 or 4.0 - nordvall/WifExamples GitHub Wiki

Developing with WIF in .NET 3.5 and 4.0 is done using the same tools and techniques.

Your server side code needs a reference to Microsoft.IdentityModel.dll from Windows Identity Foundation. You can get it in the following ways:

  • By adding "Windows Identity Foundation" to your project from NuGet
  • By downloading and installing "Windows Identity Foundation" from download.microsoft.com
  • By copying it from the code samples here.

Client side code does not need any WIF components.

Official SDK

There is a "Windows Identity Foundation SDK" available on download.microsoft.com. The SDK includes the WIF assemblies, as well as:

  • Some project items for Visual Studio, i.e. "Claims enabled web site" and "Claims enabled WCF service".
  • A configuration wizard, sometimes called FedUtil.exe. It can enable claims authentication in an existing web project. I am not very satisfied with the wizard. It inserts tons of config settings in your web config, which makes it very hard to find the right parameters if you need to adjust something. And if it magically works in your development environment, it will be difficult to move the code to production.

Set up your project

Instead I recommend this:

  • Get the Microsoft.IdentityModel.dll (see above) and include it in your project.
  • Copy the DummySTS web application project from the code samples here and include it in your project.
  • Find the code project here on the site that best matches your setup (NET 3.5 or 4.0, HTTP/HTTPS, server/client...) and copy the relevant parts from web.config/app.config.
  • Make up an identifier for your service, it could be something like "urn:yourcompany:yourservice".
    • Add the identifier to the web.config of the DummySTS site.
    • Also put it in the web.config of your own web project.

Now you should be able to start the website using Debug mode in Visual Studio. Use the "Multiple startup projects" option to start both the DummySTS and your web site at the same time.