吭哧了一天,被两个问题绊住了. 在这里记录一下.
一 Cookie Samesite 设置
Chrome更新了浏览器规则, 使得 不使用https 的identityserver4 配置无法获取正确的cookie导致登录时无效
二 IdentityServer4 middleware 的配置:
// IdentityServer4 的middleware 一定要放到 UseAuthentication 前面,因为 UseAuthentication 会启用权限,屏蔽掉正常的请求 !!!
app.UserIS4();
app.UseAuthorization();
app.UseAuthentication();
否则会导致, UseAuthentication 屏蔽identityserver4 的请求,从而导致client 认证无法正确跳转,而是跳转到mvc上