OpenSAML 请求到 Azure AD 的 CORS 错误“PreflightMissingAllowOriginHeader”

问题描述 投票:0回答:0
我已经搜索了好几天,但找不到合适的解决方案来让我的 SSO 通过 OpenSAML 正常工作。原因是当我尝试将 SAML 请求重定向到 IdP (Azure AD) 时出现 CORS 错误“PreflightMissingAllowOriginHeader”。

所以基本上我现在做的是以下内容:

    用户通过导航到他未登录的受保护页面来触发身份验证。
  1. GWT客户端通过RPC调用向GWT服务器端发送请求。
  2. SAML 中的应用程序或服务提供商 (SP) 构建 SAML 身份验证请求 (AuthnRequest) 并将其重定向到 IdP (Azure AD)。
  3. (通常 MFA 会触发,但我收到 CORS 错误)
在我看来,这种情况下的错误是正确的,但我如何才能在我的环境中更改预检标头?

系统环境:

    Java 8
  • Eclipse 码头网络服务器 4.9.49
  • GWT-Framework 2.8.2
  • OpenSAML 3.2.0
  • Azure AD 作为 IdP

响应头(预检):

Cache-Control: no-store, no-cache Content-Encoding: gzip Content-Length: 40803 Content-Type: text/html; charset=utf-8 Date: Wed, 05 Apr 2023 07:07:32 GMT Expires: -1 Link: <https://aadcdn.msauth.net>; rel=preconnect; crossorigin Link: <https://aadcdn.msauth.net>; rel=dns-prefetch Link: <https://aadcdn.msftauth.net>; rel=dns-prefetch nel: {"report_to":"network-errors","max_age":86400,"success_fraction":0.001,"failure_fraction":1.0} P3P: CP="DSP CUR OTPi IND OTRi ONL FIN" Pragma: no-cache Referrer-Policy: strict-origin-when-cross-origin report-to: {"group":"network-errors","max_age":86400,"endpoints":[{"url":"https://identity.nel.measure.office.net/api/report?catId=<<CAT_ID>>"}]} Set-Cookie: fpc=AjRI9MA0hDRJhucHRbH9GwE; expires=Fri, 05-May-2023 07:07:32 GMT; path=/; secure; HttpOnly; SameSite=None Set-Cookie: esctx=<<COOKIE>>; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None Set-Cookie: x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly Set-Cookie: stsservicecookie=estsfd; path=/; secure; samesite=none; httponly Strict-Transport-Security: max-age=31536000; includeSubDomains Vary: Accept-Encoding X-Content-Type-Options: nosniff X-DNS-Prefetch-Control: on x-ms-ests-server: 2.1.14939.4 - WEULR2 ProdSlices x-ms-request-id: <<REQUEST_ID>> X-XSS-Protection: 0
到目前为止我已经尝试过:

  • 在 HTTPRedirectDeflateEncoder 的 HttpServletResponse 对象中手动设置标头

  • 向 org.eclipse.equinox.http.servlet.ExtendedHttpService 添加过滤器,将标头添加到 HttpServletResponse

  • 使用扩展 org.eclipse.jetty.server.handler.AbstractHandler 的 CorsHandler 自定义 Jetty

gwt cors single-sign-on jetty opensaml
© www.soinside.com 2019 - 2024. All rights reserved.