ADFS sso 和使用 passport-saml Express "No decryption key for encrypted SAML response"

ADFS sso and using passport-saml Express "No decryption key for encrypted SAML response"

我在记录 ADFS SSO 时遇到了这个问题。 "No decryption key for encrypted SAML response"。 从另一个帐户登录成功。有人可以帮我解决这个问题。我正在使用带有 passport-saml 工作的 Express。

这是我卡住的代码快照。

node_modules/passport-saml/lib/passport-saml/saml.js 为空。在第 623:15

 if (encryptedAssertions.length == 1) {
  if (!self.options.decryptionPvk)
    throw new Error('No decryption key for encrypted SAML response');
  var encryptedAssertionXml = encryptedAssertions[0].toString();

加密在 SAML 中的工作原理:身份提供者使用服务提供者的 public 密钥加密 SAML 响应的某些元素。服务提供商使用与用于加密的 public 密钥相对应的私钥进行解密。换句话说,服务提供商需要拥有一个密钥对 - 私钥和 public 密钥 - 此用例才能正常工作。

上述密钥对的私钥需要通过passport-saml中的decryptionPvk参数进行配置。由于断言已加密,但在 decryptionPvk 中找不到私钥,passport-saml 抱怨。

要么删除 ADFS 端的加密,要么将私钥提供给 passport-saml。