mirror of https://github.com/status-im/codimd.git
Add https_proxy support to gitlab oauth
Signed-off-by: Ruben ten Hove <git@rhtenhove.nl>
This commit is contained in:
parent
c9df47daba
commit
bac3921197
|
@ -6,16 +6,24 @@ const GitlabStrategy = require('passport-gitlab2').Strategy
|
||||||
const config = require('../../../config')
|
const config = require('../../../config')
|
||||||
const response = require('../../../response')
|
const response = require('../../../response')
|
||||||
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
||||||
|
const HttpsProxyAgent = require('https-proxy-agent');
|
||||||
|
|
||||||
const gitlabAuth = module.exports = Router()
|
const gitlabAuth = module.exports = Router()
|
||||||
|
|
||||||
passport.use(new GitlabStrategy({
|
let gitlabAuthStrategy = new GitlabStrategy({
|
||||||
baseURL: config.gitlab.baseURL,
|
baseURL: config.gitlab.baseURL,
|
||||||
clientID: config.gitlab.clientID,
|
clientID: config.gitlab.clientID,
|
||||||
clientSecret: config.gitlab.clientSecret,
|
clientSecret: config.gitlab.clientSecret,
|
||||||
scope: config.gitlab.scope,
|
scope: config.gitlab.scope,
|
||||||
callbackURL: config.serverURL + '/auth/gitlab/callback'
|
callbackURL: config.serverURL + '/auth/gitlab/callback'
|
||||||
}, passportGeneralCallback))
|
}, passportGeneralCallback)
|
||||||
|
|
||||||
|
if (process.env['https_proxy']) {
|
||||||
|
let httpsProxyAgent = new HttpsProxyAgent(process.env['https_proxy']);
|
||||||
|
gitlabAuthStrategy._oauth2.setAgent(httpsProxyAgent);
|
||||||
|
}
|
||||||
|
|
||||||
|
passport.use(gitlabAuthStrategy)
|
||||||
|
|
||||||
gitlabAuth.get('/auth/gitlab', function (req, res, next) {
|
gitlabAuth.get('/auth/gitlab', function (req, res, next) {
|
||||||
setReturnToFromReferer(req)
|
setReturnToFromReferer(req)
|
||||||
|
|
Loading…
Reference in New Issue