0
我們需要實施基於SAML的安全身份驗證。我們的IDP將是Okta和OneLogin。爲此,我們在我們的node.js express應用程序中使用「passport」+「passport-saml」。我們用下面的策略配置在SP側Okta-passport-saml問題用於解碼和驗證已簽名的SAML響應
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'
};
但1563它給錯誤爲「無法讀取屬性未定義‘的getAttribute’」而對於OneLogin,它會將錯誤提示爲「無效簽名」。此外,我們調試到模塊中,發現Okta在找到算法和OneLogin時會中斷,它能夠解密'CipherData',但在驗證簽名時會中斷。
我們的私人密鑰格式是 -
-----BEGIN PRIVATE KEY-----
-----END PRIVATE KEY-----
請幫我們進入這一點。