Programming Microsoft ASP.NET 4 - Dino Esposito [419]
In ASP.NET, the domain attribute in the Add the preceding script to the web.config file of the Web sites named www.contoso.com and blogs.contoso.com and you’ll have them share the authentication cookies (if the client browser recognizes the domain attribute of the cookie, which most modern browsers do). The effect of the setting is that the primary domain (www) and any other subdomains will be able to handle each other’s authentication cookies, always with the proviso that their web.config files are synchronized on the machine key values. Note Setting the domain attribute doesn’t cause anything to be emitted into the authentication ticket; it simply forces all Forms authentication methods to properly set the domain property on each issued or renewed ticket. The attribute is ignored if cookieless authentication is used. The domain attribute of the External Applications to Authenticate Users The two applications must have identical machine keys configured for this to work. If the application is using cookied authentication tickets, no additional work is necessary. The authentication ticket will be stored in a cookie and sent back to the original application. If cookieless authentication is used, some extra work is required to enable the external application to authenticate for us. You need to set the enableCrossAppRedirects attribute in Upon successful authentication, the ticket is generated and attached to a query string parameter to be marshaled back to the original application. If the enableCrossAppRedirects attribute is missing and cookieless authentication is used, the external application will throw an exception. Note To test this feature in practice, ensure that the Forms Authentication and Secured Sockets This means that first you must deploy your login page on an HTTPS-capable server, and second you need to set the requireSSL attribute to true in the If you don’t want to use SSL to protect the ticket, the best you can do to alleviate the risk of replay attacks is set the shortest lifetime for the authentication ticket to a value that is reasonable for the application. Even if the ticket is intercepted, there won’t be much time remaining for the attacker to do his or her (bad) things. As a final note regarding SSL, consider the following. If requireSSL is set and the user attempts to log
Forms authentication also supports having the login page specified in another application in the same Web site:
A hacker who manages to steal a valid authentication ticket is in a position to perpetrate a replay attack for the lifetime of the ticket. To mitigate the risk of replay attacks, you can perform authentication over a secured socket. Using secured sockets also removes the threat represented by applications such as Firesheep (http://en.wikipedia.org/wiki/Firesheep) that can sniff unencrypted cookies.