OWIN 已通过另一个 project/website 的身份验证

OWIN Already Authenticated from another project/website

我正在开发两个独立的 MVC 应用程序。 对于这两个,我都实现了 OWIN ... 是这样的:

  var identity = new ClaimsIdentity(claims, DefaultAuthenticationTypes.ApplicationCookie);

        this.AuthenticationManager.SignIn(new AuthenticationProperties
        {
            AllowRefresh = true,
            IsPersistent = rememberMe,
            ExpiresUtc = DateTime.UtcNow.AddDays(7)
        }, identity);

我的问题:如果我登录APP1,然后转到APP2,我会自动登录到APP2。

每个项目中的 web.config 文件是否都有明确定义的 <machinekey>

<machineKey decryptionKey="[some value]" validationKey="[some value]" />

如果两个站点都在同一个域中(website1.domain.com,website2.domain.com),cookie 将持续存在,并且将尝试解密。因此,如果两个配置文件都定义了密钥并且相同,它将假定进行身份验证。

虽然这取决于您如何定义身份验证,但情况可能并非如此。