Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do Forms Authentication Across Applications in asp.net mvc

Tags:

asp.net-mvc

How to do Forms Authentication Across Applications in asp.net mvc

Lets say that two websites www.xyz.com and www.abc.com.

I have to use same user credentials for both the sites. If i redirect one app to another then it wont ask to sign in.

like image 562
yogeswaran K Avatar asked Feb 21 '23 23:02

yogeswaran K


2 Answers

If the applications are hosted on the same domain (for example http://foo.example.com and http://bar.example.com) you could perform Single Sign On by simply setting the domain property of the authentication cookie in your web.config and configuring the same machine keys. The scenario is detailed in this article.

For cross domain SSO, there's much more to be done as you cannot use cookies. So when passing from AppA to AppB you could send the authentication token value (POST or GET) and have AppB decrypt it and emit an authentication cookie on its own domain. Of course in order to decrypt it, both applications must have the same machine keys configured. The scenario is detailed in this article.

like image 188
Darin Dimitrov Avatar answered Feb 23 '23 13:02

Darin Dimitrov


how about implementing a single sign on service? such that when you log in, you call the service using AJAX and retrieve the user session token. you just pass the user session token to the other site so that you may validate it and use the same user.

like image 22
Ann B. G. Avatar answered Feb 23 '23 14:02

Ann B. G.