Identity Server 4拒绝构架SignOutIframeUrl

问题描述 投票:0回答:1

我具有使用UseOpenIdConnectAuthentication中间件的IdenityServer4应用程序(.net核心2.1)和2个客户端mvc应用程序(.net框架452)。我正在使用隐式流,并且试图通过Front-Channel实现单一注销。我正在使用Quickstart应用程序,并且一切都已设置为可以正常工作,我只需要返回模型中存在SignOutIframeUrl的LoggedOut.cshtml。

我的问题是,即使注销工作成功并使我从两个客户端注销,我在“网络”选项卡和“控制台”选项卡中仍收到以下错误。network tab errorcontent security policy violation

我已经尝试在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值。

asp.net-mvc asp.net-core identityserver4 openid-connect content-security-policy
1个回答
0
投票

[如果出现违反帧src的情况,则是外框的CSP阻止显示内框。如果这是违反框架祖先的行为,则内部框架会阻止外部框架显示它。好像您是从IdentityServer中构建页面一样,很可能是其他应用程序的CSP,需要将IdentityServer的源添加到frame-src。

© www.soinside.com 2019 - 2024. All rights reserved.