我正在尝试将网站迁移到核心2.0。有多个形式的cookie,
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationScheme = "cookieA",
AutomaticAuthenticate = false,
AutomaticChallenge = false
});
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationScheme = "cookieB",
AutomaticAuthenticate = false,
AutomaticChallenge = false
});
这些Cookie用于跟踪用户在登录过程中的位置。我看到在核心2.0中,此过程已更改,并已移至服务管道,但我不清楚如何创建多个cookie,以及如何翻译这些设置。此外,我正在使用身份服务器4,并且需要不修改所有必需的cookie。这在以前的版本中不是问题,但看起来这可能是一个问题。
感谢。
答案 0 :(得分:0)
您需要为您的服务添加多个Cookie身份验证
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services
.AddAuthentication()
.AddCookie("CookieA", optionA =>
{
// config cookieA
})
.AddCookie("CookieB", optionB =>
{
// config cookieB
});
}
}