Passport Saml Loop

I am trying to make an ADFS ID using Passport-Saml.js in a nodejs / angularjs project.

  • When I connect to my website, I am redirected correctly to my ADFS portal.
  • The ADFS portal, after proper authentication, redirects to the callback.
  • Then a callback loop.

Chrome console when it starts up cyclically

What is 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 he stops working with a passport. authenticate ( 'saml', function ( err, user, info) { because "up to" an output message can be seen in the console, but not "good", as shown in the screenshot. 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 that my settings may be incorrect, but is there a detailed Saml passport log to narrow down my problems.

+4
1

, :

body-parser

var bodyParser = require('body-parser');
...
app.use(bodyParser.urlencoded({extended: true}));

. , ...

+5

Source: https://habr.com/ru/post/1623081/


All Articles