title: Passport Saml Loop
body: <p>I'm trying to make a ADFS identification with Passport-Saml.js in a nodejs/angularjs project.</p>
  
  <ol>
  <li>When I'm connecting to my Web Site I'm correctly redirected to my ADFS portal.</li>
  <li>ADFS portal, after authentication correctly redirects to callback.</li>
  <li>Then the callback loop.</li>
  </ol>
  
  <p><a href="http://i.stack.imgur.com/jYhr3.png*" rel="noreferrer">Chrome console when it's looping</a></p>
  
  <p>That my route (server.js):</p>
  
  <pre><code>app.post('/login/callback',
   function (req, res, next) {
    console.log('before');
    passport.authenticate('saml', function (err, user, info){
      console.log('good');
  
  })(req, res, next);
  
  });
  </code></pre>
  
  <p>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. <a href="http://i.stack.imgur.com/KLLF0.png" rel="noreferrer">The console</a></p>
  
  <p>And my passport configuration (/config/passport.js):</p>
  
  <pre><code>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;
  </code></pre>
  
  <p>I suspect my settings might be incorrect but is there any verbose log of passport-Saml in order to narrow down my troubleshooting.</p>