title: ASP.NET MVC bypass/simulate ws-federation/claims-based authentication
body: <p>In our ASP.NET MVC 5 Project we've setup the application to use ws-federation authentication with Azure Access Control.</p>
  
  <p>Excerpts from our Web.config:</p>
  
  <pre><code>...   
  &lt;system.identityModel.services&gt;
      &lt;federationConfiguration&gt;
        &lt;cookieHandler requireSsl="false" persistentSessionLifetime="30:0:0" /&gt;
        &lt;wsFederation passiveRedirectEnabled="true" realm="http://our-realm/.../" reply="http://localhost/" requireHttps="false" issuer="https://ourissuername.accesscontrol.windows.net/v2/wsfederation" /&gt;
      &lt;/federationConfiguration&gt;
  &lt;/system.identityModel.services&gt;
  ...
  &lt;modules runAllManagedModulesForAllRequests="true"&gt;
    &lt;remove name="FormsAuthentication" /&gt;
    &lt;add name="WSFederationAuthenticationModule" type="System.IdentityModel.Services.WSFederationAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" /&gt;
    ...
  &lt;/modules&gt;
  ...
  </code></pre>
  
  <p>Later in the application, we rely on the fact that <code>ClaimsPrincipal.Current.Identity.IsAuthenticated</code> and has all the required claims, at least the E-Mail address.</p>
  
  <p>For stress-tesing purpose, we'd like to simulate a hard-coded <code>ClaimsPrincipal</code> with our custom claims (by, for example, running some custom code which is only available for this configuration) and bypass the whole wsfederation process, especially the whole redirection. We can, for example, just remove the <code>WSFederationAuthenticationModule</code> and are able to skip the ws-federation process but I don't know how to provide my own <code>ClaimsPrincipal</code>.</p>
  
  <p>Any hints how to solve that with least effort? (least effort, because it's not going to be for production etc.)</p>