提问者:小点点

用于解码和验证签名SAML响应的护照-saml发行


我们需要实现基于SAML的安全身份验证。我们的IDP将是Okta和OneLogin。为此,我们在节点中使用“passport”“passport saml”。JSExpress应用程序。我们在SP端为Okta使用以下策略配置-

var oktaLoginStrategy = {
    host: 'http://localhost:3000',
    path: '/login/callback',
    realm: 'urn:node:app',
    entryPoint: "https://dev-528399.oktapreview.com/app/builtiodev528399_oktasp1_1/exkbbi8vwj2OsHjbE0h7/sso/saml",
    issuer: "http://www.okta.com/exkbbi8vwj2OsHjbE0h7",
    additionalParams: {
        'RelayState': "test"
    },
    signatureAlgorithm: 'sha256',
    decryptionPvk: privateKey,
    privateCert: privateKey,
    cert: oktaPublicKey,
    identifierFormat: 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'
};

对于OneLogin,我们使用-

var oneLoginStrategy = {
    host: 'http://localhost:3000',
    path: '/login/callback',
    realm: 'urn:node:app',
    entryPoint: "https://flow-dev.onelogin.com/trust/saml2/http-post/sso/686218",
    issuer: "https://app.onelogin.com/saml/metadata/686218",
    additionalParams: {
        'RelayState': "test"
    },
    signatureAlgorithm: 'sha256',
    decryptionPvk: privateKey,
    privateCert: privateKey,
    cert: oneLoginPublicKey,
    validateInResponseTo: true,
    identifierFormat: 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'
};

但对于Okta,它给出的错误是“无法读取未定义的属性'getAttribute',对于OneLogin,它给出的错误是“无效签名”。此外,我们在模块中进行了调试,发现对于Okta,它在查找算法时中断,对于OneLogin,它能够解密“CipherData”,但在验证签名时中断。

我们的私钥格式是-

-----BEGIN PRIVATE KEY-----
-----END PRIVATE KEY-----

请帮我们解决这个问题。


共1个答案

匿名用户

这里的问题是来自Okta SAML断言格式,我们在xml加密模块的"decryptKeyInfo"函数中进行了更改,该函数用于从断言中找到"keyEncryptionmethod"。关于OneLogin这是我们的设置问题。