我正在开发一个使用IdentityServer 4和的应用程序。Net 5我创建了基于“with React”的项目。js’和单独的身份验证模板。
当我在本地运行应用程序时,如果我通过docker运行它,那么当我尝试以静默方式登录时,一切都正常运行,并将我重定向回登录屏幕
我唯一的猜测是,当登录/重定向发生时,我看到这些消息时,身份验证cookie出现了问题
warn: Microsoft.AspNetCore.Http.ResponseCookies[1]
The cookie 'Identity.External' has set 'SameSite=None' and must also set 'Secure'.
warn: Microsoft.AspNetCore.Http.ResponseCookies[1]
The cookie 'idsrv.session' has set 'SameSite=None' and must also set 'Secure'.
warn: Microsoft.AspNetCore.Http.ResponseCookies[1]
The cookie '.AspNetCore.Identity.Application' has set 'SameSite=None' and must also set 'Secure'.
我试图更改cookies
SecurePolicy
到
CookieSecurePolicy.Always
services.AddAuthentication()
.AddIdentityServerJwt()
.AddCookie(options =>
{
options.CookieManager = new ChunkingCookieManager();
options.Cookie.HttpOnly = true;
options.Cookie.SameSite = SameSiteMode.None;
options.Cookie.SecurePolicy = CookieSecurePolicy.Always;
});
但它没有任何影响,也不知道为什么会发生这个问题?
谢谢