Gitter migration: Setup redirects (rollout pt. 3)
[gitter.git] / server / handlers / auth-providers / gitlab.js
blobc1fcad2260f986c280aa54c1d86c1159081583ab
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-gitlab'),
17   trackLoginForProvider('gitlab'),
18   passport.authorize('gitlab', { failWithError: true })
21 routes.callback = [
22   identifyRoute('login-callback'),
23   passportCallbackForStrategy('gitlab', { failWithError: true }),
24   ensureLoggedIn,
25   rememberMe.generateRememberMeTokenMiddleware,
26   redirectAfterLogin
29 module.exports = routes;