mirror of https://github.com/status-im/codimd.git
Add https_proxy support to gitlab oauth (#1296)
Add https_proxy support to gitlab oauth
This commit is contained in:
commit
7fd36b1b33
|
@ -6,16 +6,24 @@ const GitlabStrategy = require('passport-gitlab2').Strategy
|
|||
const config = require('../../../config')
|
||||
const response = require('../../../response')
|
||||
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
||||
const HttpsProxyAgent = require('https-proxy-agent')
|
||||
|
||||
const gitlabAuth = module.exports = Router()
|
||||
|
||||
passport.use(new GitlabStrategy({
|
||||
const gitlabAuthStrategy = new GitlabStrategy({
|
||||
baseURL: config.gitlab.baseURL,
|
||||
clientID: config.gitlab.clientID,
|
||||
clientSecret: config.gitlab.clientSecret,
|
||||
scope: config.gitlab.scope,
|
||||
callbackURL: config.serverURL + '/auth/gitlab/callback'
|
||||
}, passportGeneralCallback))
|
||||
}, passportGeneralCallback)
|
||||
|
||||
if (process.env['https_proxy']) {
|
||||
const httpsProxyAgent = new HttpsProxyAgent(process.env['https_proxy'])
|
||||
gitlabAuthStrategy._oauth2.setAgent(httpsProxyAgent)
|
||||
}
|
||||
|
||||
passport.use(gitlabAuthStrategy)
|
||||
|
||||
gitlabAuth.get('/auth/gitlab', function (req, res, next) {
|
||||
setReturnToFromReferer(req)
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
"handlebars": "~4.1.2",
|
||||
"helmet": "~3.20.0",
|
||||
"highlight.js": "~9.15.9",
|
||||
"https-proxy-agent": "^3.0.1",
|
||||
"i18n": "~0.8.3",
|
||||
"ionicons": "~2.0.1",
|
||||
"isomorphic-fetch": "~2.2.1",
|
||||
|
|
|
@ -6449,6 +6449,14 @@ https-browserify@^1.0.0:
|
|||
resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73"
|
||||
integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=
|
||||
|
||||
https-proxy-agent@^3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-3.0.1.tgz#b8c286433e87602311b01c8ea34413d856a4af81"
|
||||
integrity sha512-+ML2Rbh6DAuee7d07tYGEKOEi2voWPUGan+ExdPbPW6Z3svq+JCqr0v8WmKPOkz1vOVykPCBSuobe7G8GJUtVg==
|
||||
dependencies:
|
||||
agent-base "^4.3.0"
|
||||
debug "^3.1.0"
|
||||
|
||||
i18n@~0.8.3:
|
||||
version "0.8.3"
|
||||
resolved "https://registry.yarnpkg.com/i18n/-/i18n-0.8.3.tgz#2d8cf1c24722602c2041d01ba6ae5eaa51388f0e"
|
||||
|
|
Loading…
Reference in New Issue