我有一个带有用户帐户的MVC 5 Web应用程序。
每个帐户都有自己的子域名(http://accountname.myapp.com)
我希望有一个用户可以登录的中央登录页面。
第一个与accountname完美配合。但是我怎样才能实现第二个呢?
当我在http://myapp.com/Login登录然后重定向用户时,是否有可能将身份验证Cookie设置为accountname.myapp.com?
我的登录方法目前看起来像这样:
var claims = new List<Claim>();
claims.Add(new Claim(ClaimTypes.Sid, authUser.Id.ToString()));
claims.Add(new Claim(ClaimTypes.PrimarySid, authUser.Account.Id.ToString()));
claims.Add(new Claim(ClaimTypes.Email, authUser.Email));
var identity = new ClaimsIdentity(claims, DefaultAuthenticationTypes.ApplicationCookie);
//AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = model.Remember }, identity);