分享owin身份的cookie MVC 5? [英] Sharing owin identity cookie with MVC 5?

查看:204
本文介绍了分享owin身份的cookie MVC 5?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I'm做SSO应用程序与用户同治MVC中5,但我不能共享应用程序,例如之间的cookie的

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

HTTP:// SSO
HTTP://应用

http ://SSO http ://app

diferent网站,我觉得这有点像跨域,所以在APP2当我在startup.auth像这样

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))
            }
        });

更新:
感谢Chris普拉特的,有没有办法做到这一点至极的答案使我另一个问题是
我可以共享的。

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和
name2.domain.com/app2

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

使用OWIN

推荐答案

今天发现这篇文章的code项目时,我想知道同样的事情,不是100%肯定,但肯定似乎可以给我。

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

1部分 - 设计:
http://www.$c$cproject.com/Articles/106439/Single-Sign-On-SSO-for-cross-domain-ASP-NET-applic

2部分 - 实现:
http://www.$c$cproject.com/Articles/114484/Single-Sign-On-SSO-for-cross-domain-ASP-NET-appl

当然这不是真正共享域之间的cookie,但使用SSO用户管理网络服务(这似乎没什么问题!)

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 :)

这篇关于分享owin身份的cookie MVC 5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆