小编Ler*_*roi的帖子

在 jenkinsfile 中使用主动选择反应参数

我正在使用主动选择反应参数,我想访问我的 jenkinsfile 中的选定值。

环境设置

主动选择反应参数

参考环境设置

有什么方法可以访问 jenkinsfile 中的 select_server 吗?因为我尝试过${select_server},但没有成功。

jenkins jenkins-plugins jenkins-pipeline

2
推荐指数
1
解决办法
2670
查看次数

如何为身份服务器启用内容安全策略?

我有一个连接到我的身份服务器的微前端。为了让用户访问微前端,用户需要通过该ID服务器进行身份验证。微前端需要嵌入到我的主应用程序的 iframe 中,但由于该微前端需要 ID 服务器,因此我在控制台上收到错误。在嵌入这个微前端之前一切都工作正常,但是当它进入 iframe 时我就遇到了这个问题。

Refused to frame 'https://localhost:44300/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'none'".
Run Code Online (Sandbox Code Playgroud)

我尝试将其包含在我的身份服务器的 web.config 文件中,这导致控制台上出现上述错误。

<system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="Content-Security-Policy" value="frame-ancestors ''" />
      </customHeaders>
    </httpProtocol>
  </system.webServer>
Run Code Online (Sandbox Code Playgroud)

ID 服务器似乎不允许将其内容嵌入 iframe 中。这可能不是一个好的做法,但根据我的要求,我想知道如何实现这一点。

更新

这是定义 csp 的地方

public override void OnResultExecuting(ResultExecutingContext context)
        {
            var result = context.Result;
            if (result is ViewResult)
            {
                // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
                if (!context.HttpContext.Response.Headers.ContainsKey("X-Content-Type-Options"))
                {
                    context.HttpContext.Response.Headers.Add("X-Content-Type-Options", "nosniff");
                }

                // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
                if (!context.HttpContext.Response.Headers.ContainsKey("X-Frame-Options"))
                {
                    context.HttpContext.Response.Headers.Add("X-Frame-Options", "SAMEORIGIN");
                }

                // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
                var csp …
Run Code Online (Sandbox Code Playgroud)

asp.net asp.net-mvc content-security-policy identityserver4

1
推荐指数
1
解决办法
6772
查看次数