Windows Identity Foundation (WIF): How to Protect Static Content with the Federation Authentication Module (FAM)

Windows Identity Foundation (WIF): How to Protect Static Content with the Federation Authentication Module (FAM)

Table of Contents


The most common scenario for protecting a web application with the Windows Identity Foundation (WIF) Federation Authentication Module (FAM) is to use ASP.NET content. Using FedUtil.exe (WIF SDK) to configure your web.config file works fine in this scenario. When static content is introduced, such as a static .htm file, you'll find that the static content isn't protected by FAM the way you would expect. This article describes the extra steps needed in order to protect static content with the WIF FAM.

Start by reading the "Enabling ASP.NET Services for All Types of Content" section of this article.

The extra configuration needed is as follows:

  1. Edit the application's web.config file
  2. Add this line: <modules runAllManagedModulesForAllRequests="true" /> within <system.webServer>


More Information

If you are protecting static content and you expect to rely on the Windows file system ACL to provide authorization via a Windows token, then you will need to invoke the Claims-to-Windows token Service (C2WTS) that ships with the WIF runtime. C2WTS can be invoked by adding the following lines to the application's web.config file in the <service> section within <microsoft.IdentityModel>:

<!--By default, the SAML 1.1 security token handler does not have the map-to-windows feature enabled. In addition, it does not use the Windows Token Service to create the windows identities.
        To turn these features on, this sample replaces the default handler with another instance of the token handler which has these features enabled.-->
        <add type="Microsoft.IdentityModel.Tokens.Saml11.Saml11SecurityTokenHandler, Microsoft.IdentityModel, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
          <samlSecurityTokenRequirement mapToWindows="true" useWindowsTokenService="true" />

If you decide to invoke C2WTS, you will need to modify the allowed callers list in the service configuration file named c2wtshost.exe.config, which is located in %programfiles%\Windows Identity Foundation\v3.5\. The service account that runs your application pool needs to be added to the list of allowed callers.



<add value="\MyAppSvcAccount" />



Finally, set the C2WTS service start-up type to Automatic and Start the C2WTS service within the Services MMC console.


Leave a Comment
  • Please add 8 and 8 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Page 1 of 1 (2 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
  • Ed Price MSFT edited Original. Comment: Updated title case.

  • Fernando Lugão Veltem edited Revision 1. Comment: added toc

Page 1 of 1 (2 items)