angular 4 个客户端连接到 PingFed SAML2.0 但没有收到 'Access-Control-Allow-Origin' CORS 错误

angular 4 client reaching out to PingFed SAML2.0 but getting No 'Access-Control-Allow-Origin' CORS error

我的 angular 4 客户端正在连接到 PingFed 服务器以进行基于 SAML2 的身份验证。

我们使用 saml2-js npm 模块作为浏览器和 pingfed 服务器之间的中间件。

当我按下登录按钮启动登录过程时,我在我的控制台中看到了这个

Failed to load https://mypingfed-server/idp/startSSO.ping?SAMLRequest=someSAMLpayload: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://localhost:3000' is therefore not allowed access. The response had HTTP status code 500.

这是一个加载了 saml2-js 模块的服务器端点的 GET 请求。端点发送导致 302 重定向的请求。

我的问题是 - 如何在 pingfed saml 2.0 服务器上设置响应 header 属性?

似乎没有关于如何在 pingfed 服务器上设置此属性的文档。

此外,这是否是正确的方法? IE。我的客户端配置中是否存在导致此问题的盲点?

原来文档在这里:

https://documentation.pingidentity.com/pingfederate/pf84/#adminGuide/concept/addingCustomHttpResponseHeaders.html

根据文档,您可以在 response-header-admin-config.xml 文件或 response-header-runtime-config.xml.[ 中配置服务器的响应 headers。 =11=]

我已经确认它可以解决我的问题。问题是服务器没有返回所需的响应 headers。这是一个 COR 问题,已通过正确配置 pingfed 服务器解决。