From fd00272314ba9a5aa772d29585a17616482a1ce5 Mon Sep 17 00:00:00 2001 From: DerekJarvis <6828105+DerekJarvis@users.noreply.github.com> Date: Thu, 11 May 2023 17:42:17 -0700 Subject: [PATCH] feat(auth): allow custom GitLab endpoints for self-managed instances (#6399) * Allow custom GitLab endpoints for self-hosting --------- Co-authored-by: Nicolas Giard --- server/modules/authentication/gitlab/authentication.js | 2 ++ server/modules/authentication/gitlab/definition.yml | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/server/modules/authentication/gitlab/authentication.js b/server/modules/authentication/gitlab/authentication.js index 15d5229b..f060ad8e 100644 --- a/server/modules/authentication/gitlab/authentication.js +++ b/server/modules/authentication/gitlab/authentication.js @@ -15,6 +15,8 @@ module.exports = { clientSecret: conf.clientSecret, callbackURL: conf.callbackURL, baseURL: conf.baseUrl, + authorizationURL: conf.authorizationURL || (conf.baseUrl + '/oauth/authorize'), + tokenURL: conf.tokenURL || (conf.baseUrl + '/oauth/token'), scope: ['read_user'], passReqToCallback: true }, async (req, accessToken, refreshToken, profile, cb) => { diff --git a/server/modules/authentication/gitlab/definition.yml b/server/modules/authentication/gitlab/definition.yml index e18dccb8..ec26d613 100644 --- a/server/modules/authentication/gitlab/definition.yml +++ b/server/modules/authentication/gitlab/definition.yml @@ -24,3 +24,13 @@ props: hint: For self-managed GitLab instances, define the base URL (e.g. https://gitlab.example.com). Leave default for GitLab.com SaaS (https://gitlab.com). default: https://gitlab.com order: 3 + authorizationURL: + type: String + title: Authorization URL + hint: For self-managed GitLab instances, define an alternate authorization URL (e.g. http://example.com/oauth/authorize). Leave empty otherwise. + order: 4 + tokenURL: + type: String + title: Token URL + hint: For self-managed GitLab instances, define an alternate token URL (e.g. http://example.com/oauth/token). Leave empty otherwise. + order: 5