Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've implemented a SSO solution between multiple ASP.NET MVC applications hosted on the same parent domain (app1.domain.com, app2.domain.com, ...) by using Forms Authentication and setting the <a href="http://msdn.microsoft.com/en-us/library/1d3t3c61.aspx" rel="noreferrer">domain</a> property of the cookie in web.config of all applications:</p> <pre><code>&lt;forms name="ssoauth" loginUrl="/login" protection="All" timeout="120" requireSSL="true" slidingExpiration="false"&gt; domain="domain.com" /&gt; </code></pre> <p>When you set the domain property of the cookie, this cookie will automatically be sent by the client browser to all applications hosted on this domain and will be able to authenticated the user automatically.</p> <p>If you want to implement a cross domain SSO using Forms Authentication here's what you could do:</p> <ol> <li>The user navigates to <code>foo.com</code> and signs in. The application hosted on <code>foo.com</code> uses standard Forms Authentication, nothing fancy.</li> <li>The user decides to go to <code>bar.com</code> and clicks on a link that you created. This link could contain a token parameter which will contain the encrypted username. This <a href="http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.encrypt.aspx" rel="noreferrer">encryption could be done</a> using the machine keys and look something like this: <code>https://bar.com?token=ABC</code>.</li> <li>The application hosted on <code>bar.com</code> receives the request and because it uses the <a href="http://msdn.microsoft.com/en-us/library/ff649308.aspx" rel="noreferrer"><strong>same machine keys</strong></a> as the other application it is capable of <a href="http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.decrypt.aspx" rel="noreferrer">decrypting the token</a> and fetching the username. Then it simply signs in the user by emitting an authentication cookie locally and the user is automatically signed in <code>bar.com</code>.</li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload