I'm trying to make a ADFS identification with Passport-Saml.js in a nodejs/angularjs project.
Chrome console when it's looping
That my route (server.js):
app.post('/login/callback',
function (req, res, next) {
console.log('before');
passport.authenticate('saml', function (err, user, info){
console.log('good');
})(req, res, next);
});
I think it stops working at passport.authenticate('saml',function (err,user, info){ because "before" output message can be seen in the console but nor the "good" as seen in the screenshot. The console
And my passport configuration (/config/passport.js):
var
fs = require('fs')
, passport = require('passport')
, SamlStrategy = require('passport-saml').Strategy
;
passport.serializeUser(function (user, done) {
done(null, user);
});
passport.deserializeUser(function (user, done) {
done(null, user);
});
passport.use(new SamlStrategy(
{
entryPoint: 'https://logon.XXX.com/adfs/ls/',
issuer: 'urn:backpack-test',
callbackUrl: ' https://backpack-test.XXX.com/login/callback',
cert: 'MIIC6D...,
authnContext: 'http://schemas.microsoft.com/ws/2008/06/identity/authenticationmethod/password',
//acceptedClockSkewMs: -1,
identifierFormat: null,
//signatureAlgorithm: 'sha256'
},
function (profile, done) {
return done(null,
{
upn: profile['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn'],
// e.g. if you added a Group claim
group: profile['http://schemas.xmlsoap.org/claims/Group']
});
}
));
module.exports = passport;
I suspect my settings might be incorrect but is there any verbose log of passport-Saml in order to narrow down my troubleshooting.
Maybe is this problem: Check this bug
Just add the body-parser
var bodyParser = require('body-parser');
...
app.use(bodyParser.urlencoded({extended: true}));
It worked for me. Maybe it can help others...