I am trying to implement passport.js in my Meteor project and I am kind of stuck sending user information via passport.
Firstup, I am building an authentication system that uses LDAP on the organization's side. The y have bought Shibboleth's Identity Provider, http://shibboleth.net/products/identity-provider.html and wants to use passport-saml as an authenticating framework residing the web app. I have followed this git tutorial, https://github.com/bergie/passport-saml , as well as the official passport.js tutorial and I have implemented the methods in passport.js in the server side of Meteor.
Meteor.startup(function () {
var require = Npm.require;
passport = require('passport');
var SamlStrategy = require('passport-saml').Strategy;
passport.use(new SamlStrategy(
{
path: '/login/callback',
entryPoint: 'https://openidp.feide.no/simplesaml/saml2/idp/SSOService.php',
issuer: 'passport-saml'
},
function(profile, done) {
findByEmail(profile.email, function(err, user) {
if (err) {
return done(err);
}
return done(null, user);
});
}
));
Meteor.Router.add('/login/callback', 'POST', function(req, res){
passport.authenticate('saml', { failureRedirect: '/', failureFlash: true });
res.redirect('/');
});
Meteor.Router.add('/login', 'POST', function(req, res){
passport.authenticate('saml', { failureRedirect: '/', failureFlash: true });
res.redirect('/');
});
var app = __meteor_bootstrap__.app;
app.use(passport.initialize());
app.use(passport.session());
passport.serializeUser(function(user, done) {
done(null, user.id);
});
passport.deserializeUser(function(id, done) {
User.findById(id, function(err, user) {
done(err, user);
});
});
});
My question now is how do i get passport to send the user information over. Is it done via passing a profile object via the function in passport.use?
Thanks so much and I am unsure of how much codes i should show, just drop me a comment and i will improve this post!