我具有使用UseOpenIdConnectAuthentication
中间件的IdenityServer4应用程序(.net核心2.1)和2个客户端mvc应用程序(.net框架452)。我正在使用隐式流,并且试图通过Front-Channel实现单一注销。我正在使用Quickstart应用程序,并且一切都已设置为可以正常工作,我只需要返回模型中存在SignOutIframeUrl
的LoggedOut.cshtml。
我的问题是,即使注销工作成功并使我从两个客户端注销,我在“网络”选项卡和“控制台”选项卡中仍收到以下错误。
我已经尝试在IdentityServer的Content-Security-Policy
操作过滤器属性中添加带有各种设置的SecurityHeadersAttribute
标头,但似乎没有任何方法可以解决该问题。
几个例子:
var csp = "default-src 'self' 'unsafe-inline' http://localhost:*;"
"frame-ancestors 'self' http://localhost:*;" +
"frame-src 'self' http://localhost:*;" +
"child-src 'self' http://localhost:*;";
var csp = "default-src 'self' *.aspnetcdn.com 'unsafe-inline';" +
"frame-src 'self' *";
这是我的FrontChannelLogoutUri
操作的样子
public void ForceLogOut()
{
AuthenticationManager.SignOut(CookieAuthenticationDefaults.AuthenticationType);
AuthenticationManager.SignOut(OpenIdConnectAuthenticationDefaults.AuthenticationType);
}
我也曾尝试在Content-Security-Policy
的响应中添加ForceLogOut
标头,但也没有用。
我的问题是如何解决此错误?有一些我可能不了解的东西(但可能很多事情),但是到处尝试查找有关Refused to frame.. policy directive
问题的信息时,人们都在说我必须设置适当的frame-src
值。
[如果出现违反帧src的情况,则是外框的CSP阻止显示内框。如果这是违反框架祖先的行为,则内部框架会阻止外部框架显示它。好像您是从IdentityServer中构建页面一样,很可能是其他应用程序的CSP,需要将IdentityServer的源添加到frame-src。