2
1
mirror of https://github.com/Thream/socketio-jwt.git synced 2024-07-21 09:38:31 +02:00
socketio-jwt/test/fixture/setupPassport.js
2012-11-16 12:43:12 -03:00

23 lines
539 B
JavaScript

var passport = require('passport'),
LocalStrategy = require('passport-local').Strategy;
passport.use(new LocalStrategy(
function(username, password, done) {
if(username === 'jose' && password === 'Pa123'){
return done(null, {
name: 'jose',
mail: 'j@f.r'
});
} else {
return done(null, false, {message: 'wrong user name or password'});
}
}
));
passport.serializeUser(function(user, done) {
done(null, user);
});
passport.deserializeUser(function(user, done) {
done(null, user);
});