I've notice the passport-saml package is deprecated and I thought of upgrading the package to @node-saml/passport-saml. I've written my code similar to the one in the given github example. This is the link to the passport-saml repo https://github.com/node-saml/passport-saml
The problem is I cannot import the package as they have mentioned below
const SamlStrategy = require('passport-saml').Strategy;
so I imported like this
const SamlStrategy = require('@node-saml/passport-saml').Strategy;
The code is not throwing module not found error but the authentication is not working anymore after changing the package from passport-saml to @node-saml/passport-saml. It is displaying the "error" in the login/callback route.I couldn't able to see what is the actual error even though I'm logging it in case of any error as well as sending the error object as response. Can somebody help me ?
SOLUTION
I've got the solution! add the wantAssertionsSigned, wantAuthnResponseSigned options to the strategy configuration based on your idp provider.
wantAssertionsSigned: if true, add WantAssertionsSigned="true" to the metadata, to specify that the IdP should always sign the assertions. It is on by default. Note: either the response or the assertion must be signed even if both are turned off.
wantAuthnResponseSigned: if true, require that all incoming authentication response messages be signed at the top level, not just at the assertions. It is on by default. Note: either the response or the assertion must be signed even if both are turned off.
samlStrategy = new SamlStrategy({
issuer: process.env.saml_issuer,
protocol: 'https://',
path: '/login/callback',
entryPoint: process.env.saml_entrypoint,
cert: process.env.cert,
wantAssertionsSigned: false,
wantAuthnResponseSigned: false
}, function (profile, done) {
return done(null, profile);
});
