Sharing owin identity cookie with MVC 5?

醉酒当歌 提交于 2019-12-08 01:54:55

问题


I´m doing SSO App with user managment in MVC 5, but i cant share the cookie between apps for example

http ://SSO http ://app

diferent sites in IIS, i think this is something like cross domain,so in the app2 when i have something like this in the startup.auth

app.UseCookieAuthentication(new CookieAuthenticationOptions
        {
            CookieName = "sharedcookie",
            CookieDomain = "SSO",
            CookieHttpOnly = false,

            //CookieDomain = "localhost",
            AuthenticationType = DefaultAuthenticationTypes.ExternalCookie,
            LoginPath = new PathString("/Account/Login"),
            Provider = new CookieAuthenticationProvider
            {
                external login to your account.  
                OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
                    validateInterval: TimeSpan.FromMinutes(30),
                    regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
            }
        });

UPDATE: thanks to Chris Pratt for the answer that there is no way to do this wich leads me to another question that is can i share a cookie between

name1.domain.com/app1 and name2.domain.com/app2

With OWIN


回答1:


Found this article on code project today when I was wondering the same thing, not 100% sure but definitely seems possible to me.

Part 1 - The design: http://www.codeproject.com/Articles/106439/Single-Sign-On-SSO-for-cross-domain-ASP-NET-applic

Part 2 - The implementation: http://www.codeproject.com/Articles/114484/Single-Sign-On-SSO-for-cross-domain-ASP-NET-appl

Granted this is not actually sharing a cookie between domains but using a SSO user management web service (which seems fine to me!)

NB: I know link only answers are discouraged but these articles are huge, anyone who wants to tell me how to do this properly is welcome :)



来源:https://stackoverflow.com/questions/27821008/sharing-owin-identity-cookie-with-mvc-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!