diff --git a/server/modules/authentication/auth0/authentication.js b/server/modules/authentication/auth0/authentication.js index dd037a14d6..9eade81ab1 100644 --- a/server/modules/authentication/auth0/authentication.js +++ b/server/modules/authentication/auth0/authentication.js @@ -8,7 +8,7 @@ const Auth0Strategy = require('passport-auth0').Strategy module.exports = { init (passport, conf) { - passport.use('auth0', + passport.use(conf.key, new Auth0Strategy({ domain: conf.domain, clientID: conf.clientId, diff --git a/server/modules/authentication/azure/authentication.js b/server/modules/authentication/azure/authentication.js index 711ddb373b..a983d1486e 100644 --- a/server/modules/authentication/azure/authentication.js +++ b/server/modules/authentication/azure/authentication.js @@ -23,7 +23,7 @@ module.exports = { keyString = keyString.substring(44); } } - passport.use('azure', + passport.use(conf.key, new OIDCStrategy({ identityMetadata: conf.entryPoint, clientID: conf.clientId, diff --git a/server/modules/authentication/cas/authentication.js b/server/modules/authentication/cas/authentication.js index b099eeb73e..eae89affbe 100644 --- a/server/modules/authentication/cas/authentication.js +++ b/server/modules/authentication/cas/authentication.js @@ -8,7 +8,7 @@ const CASStrategy = require('passport-cas').Strategy module.exports = { init (passport, conf) { - passport.use('cas', + passport.use(conf.key, new CASStrategy({ ssoBaseURL: conf.ssoBaseURL, serverBaseURL: conf.serverBaseURL, diff --git a/server/modules/authentication/discord/authentication.js b/server/modules/authentication/discord/authentication.js index 4867e46823..eab94fd58a 100644 --- a/server/modules/authentication/discord/authentication.js +++ b/server/modules/authentication/discord/authentication.js @@ -9,7 +9,7 @@ const _ = require('lodash') module.exports = { init (passport, conf) { - passport.use('discord', + passport.use(conf.key, new DiscordStrategy({ clientID: conf.clientId, clientSecret: conf.clientSecret, diff --git a/server/modules/authentication/dropbox/authentication.js b/server/modules/authentication/dropbox/authentication.js index 808af4e597..c5879e0df5 100644 --- a/server/modules/authentication/dropbox/authentication.js +++ b/server/modules/authentication/dropbox/authentication.js @@ -9,7 +9,7 @@ const _ = require('lodash') module.exports = { init (passport, conf) { - passport.use('dropbox', + passport.use(conf.key, new DropboxStrategy({ apiVersion: '2', clientID: conf.clientId, diff --git a/server/modules/authentication/facebook/authentication.js b/server/modules/authentication/facebook/authentication.js index af3ba6db43..a0dfaf0f08 100644 --- a/server/modules/authentication/facebook/authentication.js +++ b/server/modules/authentication/facebook/authentication.js @@ -9,7 +9,7 @@ const _ = require('lodash') module.exports = { init (passport, conf) { - passport.use('facebook', + passport.use(conf.key, new FacebookStrategy({ clientID: conf.clientId, clientSecret: conf.clientSecret, diff --git a/server/modules/authentication/firebase/authentication.js b/server/modules/authentication/firebase/authentication.js index 05e5e9e9e4..344cd8e332 100644 --- a/server/modules/authentication/firebase/authentication.js +++ b/server/modules/authentication/firebase/authentication.js @@ -11,7 +11,7 @@ const _ = require('lodash') module.exports = { init (passport, conf) { - passport.use('firebase', + passport.use(conf.key, new FirebaseStrategy({ clientID: conf.clientId, clientSecret: conf.clientSecret, diff --git a/server/modules/authentication/github/authentication.js b/server/modules/authentication/github/authentication.js index 487884e5f7..49ac760935 100644 --- a/server/modules/authentication/github/authentication.js +++ b/server/modules/authentication/github/authentication.js @@ -24,7 +24,7 @@ module.exports = { githubConfig.userEmailURL = `${conf.enterpriseUserEndpoint}/emails` } - passport.use('github', + passport.use(conf.key, new GitHubStrategy(githubConfig, async (req, accessToken, refreshToken, profile, cb) => { try { const user = await WIKI.models.users.processProfile({ diff --git a/server/modules/authentication/gitlab/authentication.js b/server/modules/authentication/gitlab/authentication.js index 7c7a76e903..15d5229b45 100644 --- a/server/modules/authentication/gitlab/authentication.js +++ b/server/modules/authentication/gitlab/authentication.js @@ -9,7 +9,7 @@ const _ = require('lodash') module.exports = { init (passport, conf) { - passport.use('gitlab', + passport.use(conf.key, new GitLabStrategy({ clientID: conf.clientId, clientSecret: conf.clientSecret, diff --git a/server/modules/authentication/google/authentication.js b/server/modules/authentication/google/authentication.js index d7ba3b323f..3af03cb2c4 100644 --- a/server/modules/authentication/google/authentication.js +++ b/server/modules/authentication/google/authentication.js @@ -40,7 +40,7 @@ module.exports = { } } - passport.use('google', strategy) + passport.use(conf.key, strategy) }, logout (conf) { return '/' diff --git a/server/modules/authentication/keycloak/authentication.js b/server/modules/authentication/keycloak/authentication.js index 782a62a153..ce9a00c5ac 100644 --- a/server/modules/authentication/keycloak/authentication.js +++ b/server/modules/authentication/keycloak/authentication.js @@ -10,7 +10,7 @@ const KeycloakStrategy = require('@exlinc/keycloak-passport') module.exports = { init (passport, conf) { - passport.use('keycloak', + passport.use(conf.key, new KeycloakStrategy({ authorizationURL: conf.authorizationURL, userInfoURL: conf.userInfoURL, diff --git a/server/modules/authentication/microsoft/authentication.js b/server/modules/authentication/microsoft/authentication.js index e345528809..fd400628c0 100644 --- a/server/modules/authentication/microsoft/authentication.js +++ b/server/modules/authentication/microsoft/authentication.js @@ -9,7 +9,7 @@ const _ = require('lodash') module.exports = { init (passport, conf) { - passport.use('microsoft', + passport.use(conf.key, new WindowsLiveStrategy({ clientID: conf.clientId, clientSecret: conf.clientSecret, diff --git a/server/modules/authentication/oauth2/authentication.js b/server/modules/authentication/oauth2/authentication.js index 55b6cd843f..414de7a984 100644 --- a/server/modules/authentication/oauth2/authentication.js +++ b/server/modules/authentication/oauth2/authentication.js @@ -49,7 +49,7 @@ module.exports = { done(null, data) }) } - passport.use('oauth2', client) + passport.use(conf.key, client) }, logout (conf) { if (!conf.logoutURL) { diff --git a/server/modules/authentication/oidc/authentication.js b/server/modules/authentication/oidc/authentication.js index c07f4cbefb..6bd244fee8 100644 --- a/server/modules/authentication/oidc/authentication.js +++ b/server/modules/authentication/oidc/authentication.js @@ -10,7 +10,7 @@ const OpenIDConnectStrategy = require('passport-openidconnect').Strategy module.exports = { init (passport, conf) { - passport.use('oidc', + passport.use(conf.key, new OpenIDConnectStrategy({ authorizationURL: conf.authorizationURL, tokenURL: conf.tokenURL, diff --git a/server/modules/authentication/okta/authentication.js b/server/modules/authentication/okta/authentication.js index 60b303df5a..cd424ae704 100644 --- a/server/modules/authentication/okta/authentication.js +++ b/server/modules/authentication/okta/authentication.js @@ -9,7 +9,7 @@ const _ = require('lodash') module.exports = { init (passport, conf) { - passport.use('okta', + passport.use(conf.key, new OktaStrategy({ audience: conf.audience, clientID: conf.clientId, diff --git a/server/modules/authentication/rocketchat/authentication.js b/server/modules/authentication/rocketchat/authentication.js index edffef0064..c966326ee6 100644 --- a/server/modules/authentication/rocketchat/authentication.js +++ b/server/modules/authentication/rocketchat/authentication.js @@ -33,7 +33,7 @@ module.exports = { }) } - passport.use('rocketchat', + passport.use(conf.key, new OAuth2Strategy({ authorizationURL: `${siteURL}/oauth/authorize`, tokenURL: `${siteURL}/oauth/token`, diff --git a/server/modules/authentication/saml/authentication.js b/server/modules/authentication/saml/authentication.js index 2132c1ea81..1eb8e2c282 100644 --- a/server/modules/authentication/saml/authentication.js +++ b/server/modules/authentication/saml/authentication.js @@ -37,7 +37,7 @@ module.exports = { if (!_.isEmpty(conf.decryptionPvk)) { samlConfig.decryptionPvk = conf.decryptionPvk } - passport.use('saml', + passport.use(conf.key, new SAMLStrategy(samlConfig, async (req, profile, cb) => { try { const userId = _.get(profile, [conf.mappingUID], null) || _.get(profile, 'nameID', null) diff --git a/server/modules/authentication/slack/authentication.js b/server/modules/authentication/slack/authentication.js index 984ce28a6f..52d15d5fa7 100644 --- a/server/modules/authentication/slack/authentication.js +++ b/server/modules/authentication/slack/authentication.js @@ -9,7 +9,7 @@ const _ = require('lodash') module.exports = { init (passport, conf) { - passport.use('slack', + passport.use(conf.key, new SlackStrategy({ clientID: conf.clientId, clientSecret: conf.clientSecret, diff --git a/server/modules/authentication/twitch/authentication.js b/server/modules/authentication/twitch/authentication.js index 9518dd1752..e267c7e233 100644 --- a/server/modules/authentication/twitch/authentication.js +++ b/server/modules/authentication/twitch/authentication.js @@ -9,7 +9,7 @@ const _ = require('lodash') module.exports = { init (passport, conf) { - passport.use('twitch', + passport.use(conf.key, new TwitchStrategy({ clientID: conf.clientId, clientSecret: conf.clientSecret,