c# - Cross-domain authentication ASP.net MVC -


i have 2 different web application built asp.net mvc. 2 application may not running in same server nor in same domain.

i if user login in 1 of them, automatically should login in other. same should work logout.

which think best solution? know example code?

thanks!

--- edited more info ---

use case scenario:

the user has web application a opened on tab, , @ point of app there link redirects user web application b. if logged in on a, show him full page, , if not, redirect him login form.

why need it:

applications a , b built. apparently, way of accessing b clicking on link located in a, shown if have logged. problem if know url of page of b (are long , complex, still) can write on browser , access b, means security problem.

i assume cannot communicate between applications , b using shared store. (this allow shared session implementation).

the more industry standard way (openid connect) of doing of other answers have hinted at. try , give more details on right track.

both application , b should relay authentication process trusted 3rd party (which hosted in withe a, b or different application altogether) - let's call c

when user arrives @ either or b (no matter b has weird complicated urls, can bookmark those) request should contain authorization token. if doesn't, not authenticated , redirected c , presented login mechanism - user/pass form.

after successful login, redirected a/b (depending on came from) complete ever doing authentication token. now, having authentication token present authenticated.

if authenticated , redirected b, redirect should contain token well, b know how trust token.

now, if opens opens new tab, b not see token, , redirected c, redirected (she authenticated, remember?) b token, , good.

what described common flow using openid connect, , if using .net, suggest using identityserver thinktecture hard work , "c".

another option, pay such "c" hosted saas application - check out auth0


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -