-
Notifications
You must be signed in to change notification settings - Fork 54
/
passport_mock.js
37 lines (29 loc) · 939 Bytes
/
passport_mock.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var User = require('./models').User;
var FeedManager = require('getstream-node').FeedManager;
module.exports = {
initialize: function(sessionUserObject) {
return function(req, res, next) {
var passport = this;
User.findOne({username: 'Andrew'}, function(err, found){
if (err) console.log(err);
found.github_id = 639382;
found.displayName = 'Andrew';
passport._key = 'passport';
passport._userProperty = 'user';
passport.serializeUser = function(user, done) {
return done(null, user);
};
passport.deserializeUser = function(user, req, done) {
return done(null, user);
};
req._passport = {
instance: passport
};
req._passport.session = {
user: found
};
next();
});
};
}
};