mirror of
https://github.com/Thream/socketio-jwt.git
synced 2024-07-21 09:38:31 +02:00
23 lines
539 B
JavaScript
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);
|
|
}); |