我在 Azure 中通过 https url 运行 IdentityServer4,并且我正在使用带有angular-oauth2-oidc 库的 Angular CLI 项目来处理隐式流。我正在尝试设置单点注销,但它无法正常工作。
我正在调用logOut自动OAuthService配置(通过发现文档)在身份验证服务器上使用注销 url,即https://my-id4-server.example.com/connect/endsession使用包含 atoken_hint和 a 的查询字符串参数postLogoutUri。
出于某种原因,实际行为是 IdentityServer4 将浏览器重定向(302)到 url https://my-id4-server.example.com/account/logout?logoutid=...,浏览器为此获得404。此外,如果我在单独的选项卡中打开 IdentityServer 页面,我可以看到我的会话仍然存在。
预期的行为是我的会话结束,并且我被重定向回我的 SPA。
在 ID4Server 端,我配置了:
RedirectUris以及PostLogoutRedirectUris(http://localhost:4200我的 SPA 当前运行的地方)等;AllowedGrantTypes设定为ImplicitAllowedCorsOrigins还允许我的本地主机 SPA
此外,我可以在配置端点中看到endsession正确配置的.well-known端点。
在 SPA 方面,我配置了issuer、redirectUri、clientId和scope. 使用重定向返回登录就可以了。
底线:如果endsession端点重定向到account/logout哪个又给出 404,有什么问题?