title: How do I handle ActAs tokens in WIF 4.5?
body: <p>I am creating an STS using the WIF (<code>System.IdentityModel</code>) classes in .NET 4.5. This STS needs to handle an ActAs token. I have successfully prototyped the client to send an ActAs token, and this results in this error message on the server side:</p>
  
  <blockquote>
    <p>ID3265: ActAs element was found, but there was no token handlers registered to read a ActAs element. Consider adding a valid SecurityTokenHandlerCollection to the SecurityTokenHanderCollectionManager for ActAs usage.</p>
  </blockquote>
  
  <p>I see no way, however, to add a <code>SecurityTokenHandlerCollection</code> to the <code>SecurityTokenHanderCollectionManager</code>. How is this done?</p>
  
  <p>I've tried what is suggested in <a href="http://msdn.microsoft.com/en-us/library/ee517266.aspx" rel="nofollow">this</a> documentation:</p>
  
  <pre><code>&lt;securityTokenHandlers name="ActAs"&gt;
      ...
  &lt;/securityTokenHandlers&gt;
  </code></pre>
  
  <p>But that results in this error:</p>
  
  <blockquote>
    <p>ID0005: The input 'configElement.ElementInformation.Properties' collection does not contain a property named 'ActAs'.</p>
  </blockquote>
  
  <p>The "equivalent" (according to that documentation) incantation, <code>ServiceConfiguration.SecurityTokenHandlerCollectionManager["ActAs"]</code> is equally unhelpful:</p>
  
  <blockquote>
    <p>Unhandled Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
       at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
       at System.IdentityModel.Tokens.SecurityTokenHandlerCollectionManager.get_Item(String usage)</p>
  </blockquote>
  
  <p>Note that <a href="http://msdn.microsoft.com/en-us/library/hh568671.aspx" rel="nofollow">this</a> documentation gives essentially the same information as <a href="http://msdn.microsoft.com/en-us/library/ee517266.aspx" rel="nofollow">1</a>, but is specifically for .NET 4.5.</p>
  
  <p>How do I handle ActAs tokens?</p>