Gitter migration: Setup redirects (rollout pt. 3)
[gitter.git] / server / handlers / auth-providers / linkedin.js
blob74f2a171506145a40d332f2edfae02c55e6c65fc
1 'use strict';
3 var env = require('gitter-web-env');
4 var identifyRoute = env.middlewares.identifyRoute;
6 var passport = require('passport');
7 var trackLoginForProvider = require('../../web/middlewares/track-login-for-provider');
8 var rememberMe = require('../../web/middlewares/rememberme-middleware');
9 var ensureLoggedIn = require('../../web/middlewares/ensure-logged-in');
10 var redirectAfterLogin = require('../../web/middlewares/redirect-after-login');
11 var passportCallbackForStrategy = require('../../web/middlewares/passport-callback-for-strategy');
13 var routes = {};
15 routes.login = [
16 identifyRoute('login-linkedin'),
17 trackLoginForProvider('linkedin'),
18 passport.authorize('linkedin', {
19 failWithError: true,
20 state: Math.floor(Math.random() * 100000)
24 routes.callback = [
25 identifyRoute('login-callback'),
26 passportCallbackForStrategy('linkedin', { failWithError: true }),
27 ensureLoggedIn,
28 rememberMe.generateRememberMeTokenMiddleware,
29 redirectAfterLogin
32 module.exports = routes;