【发布时间】:2020-02-05 16:44:32
【问题描述】:
背景
使用 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 https://example-app.firebaseapp.com/__/auth/handler 的 ACS。
我预计会发生什么
为了能够在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 令牌之前,所有流程对我来说都是正常的。
问题
在这个(修订的)设置中哪个配置项不正确,替换它的值的正确派生是什么?
【问题讨论】:
标签: google-cloud-platform firebase-authentication saml-2.0 google-cloud-identity