Tuesday, February 15, 2011

Fixing issues with Windows Identity Foundation Code Samples

If you are just starting to work with programming using Windows Identity Foundation, chances are that you have downloaded source code from MSDN Code Gallery such as from here:

http://code.msdn.microsoft.com/odcsp14ta/Release/ProjectReleases.aspx?ReleaseId=4744

If you are working with Visual Studio 2010, chances are that the source code will not work as downloaded.  Therefore, I will provide the steps that you will need to follow in order to get many of these projects functioning as expected.

Once you have downloaded and extracted the project file, you will want to open the project in Visual Studio.  In most cases, the code samples include one or more Claims-Aware web sites.

Since Visual Studio 2010 will by default want to try and use the built-in Cassini Web Server, Visual Studio will have the property for Use dynamic ports set to true.  To correct this problem, do the following


  1. Right click on the Visual Studio web site project and select the Properties window
  2. Select the field for Use dynamic ports
  3. From the dropdown list selection, select False
  4. Save the project
  5. Repeat this process for as many web site projects as are present in the Visual Studio solution



If the solution is using an STS (Security Token Service), chances are that the Claims-aware Web Site will not work out-of-the-box with the STS configured in the Visual Studio solution.

To rectify this situation, you must perform the following steps:


  1. Right click on the Visual Studio project containing the Claims-aware Web Site
  2. Select Add STS Reference
  3. This will launch the Federation Utility wizard
  4. By default, the Federation Utility wizard should be populated with the correct location paths
  5. If the content is correctly populated, click on the Next button
  6. If you are prompted with a dialog stating that the application is not hosted on a secure connection, click on the Yes button to continue
  7. On the following screen, click on the radio button next to Use an existing STS (NOTE: If you are using the built-in Visual Studio Web Server, the Url will not be available until you browse to a web page in the STS Web Site which effectively starts the Cassini Web Server)
  8. For the STS WS-Federation metadata document location, enter the Url to the existing STS Web Site configured in the Visual Studio solution (ex: http://localhost:48924/WingtipSTS/FederationMetadata/2007-06/FederationMetadata.xml)
  9. If you wish to verify the Url, click on the Test Location button
  10. If you are prompted with a dialog stating that the security token service endpoint is not hosted on a secure connection, click on the Yes button to continue
  11. If you receive a signing certificate chain validation error dialog, click on the radio button for Disable certificate chain validation (since this is a development environment) and click on the Next button
  12. On the Security Token dialog, select the radio button for No encryption and click on the Next button
  13. If everything is configured correctly, you should see a dialog displaying the Offered Claims from the STS Web Site.  Click the Next button to proceed
  14. The final dialog will be a Summary dialog.  Click Finish on the Summary dialog to complete the Federation Utility wizard.
  15. A final message box will display stating Federation Utility completed successfully.









No comments:

Post a Comment