Skip to content

Commit

Permalink
auth: Implement router level passports instead of app level
Browse files Browse the repository at this point in the history
  • Loading branch information
sohailrajdev97 committed Dec 24, 2017
1 parent f463c80 commit 04e20bc
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 744 deletions.
12 changes: 1 addition & 11 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var admin = require('./routes/admin');
var dashboard = require('./routes/dashboard');
var index = require('./routes');
var loggermiddleware = require('./middleware/logger');
var auth = require('./middleware/auth');

// var referermiddleware = require('./middleware/referer');
var app = express();

Expand All @@ -42,16 +42,6 @@ app.use(expressSanitizer());
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

app.use(session({
resave: false,
saveUninitialized: true,
secret: 'ID-BPHC-ID'
}));
app.use(auth.adminPassport.initialize());
app.use(auth.userPassport.initialize());
app.use(auth.adminPassport.session());
app.use(auth.userPassport.session());

// A termination function on any kind of error that occours after login

app.use(function(req, res, next) {
Expand Down
1 change: 0 additions & 1 deletion middleware/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ userPassport.deserializeUser(function(id, done) {
});
});


userPassport.use(new googleStrategy({
clientID: keys.googleClientID,
clientSecret: keys.googleClientSecret,
Expand Down
Loading

0 comments on commit 04e20bc

Please sign in to comment.