背景
使用具有以下配置的 Firebase 身份验证和 SAML 身份验证提供程序:
const config = {
apiKey: "AIzaSy...",
authDomain: "example-app.firebaseapp.com",
};
firebase.initializeApp(config);
const provider = new firebase.auth.SAMLAuthProvider('saml.example-idp');
function saml() {
firebase.auth().signInWithRedirect(provider)
.then((result) => {
console.log(result);
})
.catch((error) => {
console.log(error);
});
}
SAML 上游的 CICP 配置具有服务提供者:我们的实体 id 和配置为我们的 CICP 的 ACS https://example-app.firebaseapp.com/__/auth/handler
。
我期望发生的事情
为了能够在signInWithRedirect()
Promise中设置断点then
并查看经过身份验证的用户。
实际发生了什么
流被重定向到 IdP 并处理身份验证。
IdP 发出带有自动提交加载的重定向发布页面和一个包含以下内容的multipart/form-data
表单:
- 内容处置:表单数据;name=SAMLResponse - 包含 base64 编码的签名 SAMLResponse
- 内容处置:表单数据;name=RelayState - 包含来自 SAML 流的中继状态
- 内容处置:表单数据;name="ssourl" - 包含 firebase 项目身份验证处理程序 URI
这反过来会导致 CICP 呈现并返回一个带有脚本的页面,该脚本设置
var POST_BODY=""------WebKitFormBoundary9bn7AOpnZiIRk9qZ\r\nContent....."
即不是解析表单正文并提取 SAMLResponse 字段,而是将整个 Request.body 重播到脚本中,然后调用fireauth.oauthhelper.widget.initialize();
这显然失败了,因为往返然后尝试将整个响应正文/__/auth/handler
作为查询字符串发布到端点。
我怀疑此链中缺少一个简单的配置项,因为在多部分表单数据被推送到 POST_BODY 并阻止将 SAML 令牌转换为 OAuth 令牌之前,所有流程对我来说都是正常的。
问题
在这个(编辑的)设置中哪个配置项不正确,替换它的值的正确推导是什么?