title: Token-Based Authentication in WCF
body: <p>I am creating a website which will contain both ASP.NET pages and a Flash applet.  I want to encapsulate my business logic in a WCF service which will be exposed through two endpoints:  One accesssible over the Internet through HTTP(S), for use by the Flash client, and one accessible within the data center for use by the application servers.  If this does not seem like a good approach, then stop me here; otherwise, I'll move on...</p>
  
  <p>The question is how to authenticate requests coming from the Flash client.  Since I don't want to store the user's password in a browser cookie, don't want to send the password with every request, and don't want to have to use HTTPS after the initial login, I plan on using a token-based authentication system.  I also don't want the user to have to log into the Flash client after already logging into the site itself, so I plan on using Javascript to pass the token to the Flash client when it starts.</p>
  
  <p>I know WCF supports using the .NET Framework's built-in security framework (System.Security) to enforce access control, and I would like to take advantage of this.</p>
  
  <p>The question, then, is:  <b>How do I pass the token to the WCF service when it is called by Flash, and how do I process the token on the server?</b></p>
  
  <ul>
  <li>WCF has an "issued token" authentication mode, but it appears this is intended to be used in a full-blown federation scenario with a Secure Token Service and SAML tokens--a bit more complexity that I really want.  It is possible to use this mode with my own "simple random-string" tokens?  If so, how?  Keep in mind this needs to be compatible with Flash.</li>
  <li>I could potentially pass the token in a header (either a SOAP header or an HTTP header).  In this case, once I've determined which user is making the request, how do I inform the framework so that the System.Security checks will work?</li>
  <li>Is there a different approach altogether that I should consider?  Anything that avoids sending passwords in every request, lets me use System.Security, and works with Flash is a possibility.</li>
  </ul>