passport.js - Node.js Passport SAML from multiple Identity Providers -


i've implemented passport-saml site, , i've been tasked connecting our site 2 other identity providers. in code, seems use recent definition of samlstrategy. how can set passport allow multiple different implementations of same strategy?

my implementation looks this:

passport.use(new samlstrategy(     {         path: '/saml',         entrypoint: "https://idp.identityprovider.net/idp/profile/saml2/redirect/sso",         issuer: 'https://www.serviceprovider.com/saml',         identifierformat: 'urn:domain:safemls:nameid-format:loginid'     },     function(profile, done) {         console.log("samlstrategy done", profile)         user.findone({email:profile.email}, function(err, user) {             if (err) {                 return done(err);             }             if(!user) return done(null, false, {message: 'no account associated email.'})             return done(null, user);         });     } )); 

you can give each strategy name

passport.use('config1', new samlstrategy(..), callback); passport.use('config2', new samlstrategy(..), callback); 

and

app.post('/login/callback',   function(req, res) {       var config = // extract config name somehow       passport.authenticate(config, { failureredirect: '/', failureflash: true })();   }   function(req, res) {     res.redirect('/');   } ); 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -