GCIP - 使用基于 OIDC 的外部提供程序启用授权代码授予流程

时间:2020-12-22 07:10:15

标签: google-cloud-platform google-identity identity-aware-proxy

尝试使用 Salesforce Identity 作为 IDP 配置 GCIP。尝试配置基于 OIDC 的集成。请注意,没有为基于 OIDC 的配置提供 (sfdc) 客户端机密的字段。此外,response_type=id_token 正在从 GCIP 端调用。我们想使用授权码流(response_type=code)与SFDC集成。可能吗?

enter image description here

1 个答案:

答案 0 :(得分:1)

GCIP 后端支持 OIDC 提供商的代码流。它尚未在 Cloud Console 或 Admin SDK 中公开。

请注意,它记录在 REST API 中。

您需要设置 {code: true}

这是 Node.js 中的一个片段(未经测试):

// https://cloud.google.com/identity-platform/docs/reference/rest/v2/projects.oauthIdpConfigs/patch
return new Promise((resolve, reject) => {
  request({
      headers: {
        'Authorization': `Bearer ${accessToken}`,
        'Content-Type': 'application/json',
      },
      url: `https://identitytoolkit.googleapis.com/admin/v2/projects` +
          `/${projectId}/oauthIdpConfigs/${oidcProviderId}?updateMask=responseType`,
      method: 'PATCH',
      body: JSON.stringify({
        responseType: {
          idToken: true,
          code: true,
        }
      }),
    }, (error, response) => {
      if (!error && response.statusCode === 200) {
        resolve();
      } else {
        reject(error);
      }
    });
  });
});
相关问题