passport-saml与idp集成

时间:2016-09-26 12:17:05

标签: passport.js saml passport-saml

我的应用程序需要与SAML IDP集成,我使用的是passport-saml,这是针对node.js,下面是配置

passport.use(new SamlStrategy(
  {
    issuer: 'http://192.168.1.5/assert',
    entryPoint: 'https://wwww.aa.com/webservices/public/saml2sso?SPID=http://192.168.1.5/metadata.xml',

    callbackUrl: 'http://192.168.1.5/assert',
    decryptionPvk:fs.readFileSync(path.resolve(__dirname, '..', 'certs') + "/cert.pem").toString(),
    privateCert: fs.readFileSync(path.resolve(__dirname, '..', 'certs') + "/key.pem").toString(),
    cert: [fs.readFileSync(path.resolve(__dirname, '..', 'certs') + "/dev.cer").toString()],

  },
  function (profile, done) {
    return done(null, profile);
  }
))

我知道cert parmater是来自IDP的认证(公钥),但是privateCert和decryptionPvk是什么。我将私钥key.pem作为privateCert传递,公钥(cert.pem)作为decryptionPvk传递,但它不起作用。我使用以下命令生成密钥和认证:openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -days 900

2 个答案:

答案 0 :(得分:1)

如果您还没有<{p>},请查看此thread

您仅附加了代码的配置部分,但我认为[身份验证回调](https://www.npmjs.com/package/passport-saml#provide-the-authentication-callback)部分已正确实施。 至于'cert'属性,我认为你应该根据护照-saml文档示例提供'cert.pem'的内容。

答案 1 :(得分:0)

我认为答案有点晚,但是在我们将身份验证请求发送到IdP之前,这两个选项都用于加密身份验证请求。因此,您必须同时添加两个私钥。

{decryptionPvk: privateKey, privateCert: privateKey}
相关问题