|
|
@@ -1,4 +1,5 @@
|
|
|
const debug = require('debug')('growi:service:PassportService');
|
|
|
+const urljoin = require('url-join');
|
|
|
const passport = require('passport');
|
|
|
const LocalStrategy = require('passport-local').Strategy;
|
|
|
const LdapStrategy = require('passport-ldapauth');
|
|
|
@@ -312,7 +313,7 @@ class PassportService {
|
|
|
clientId: config.crowi['security:passport-google:clientId'] || process.env.OAUTH_GOOGLE_CLIENT_ID,
|
|
|
clientSecret: config.crowi['security:passport-google:clientSecret'] || process.env.OAUTH_GOOGLE_CLIENT_SECRET,
|
|
|
callbackURL: (this.crowi.configManager.getConfig('crowi', 'app:siteUrl') != null)
|
|
|
- ? `${this.crowi.configManager.getSiteUrl()}/passport/google/callback` // auto-generated with v3.2.4 and above
|
|
|
+ ? urljoin(this.crowi.configManager.getSiteUrl(), '/passport/google/callback') // auto-generated with v3.2.4 and above
|
|
|
: config.crowi['security:passport-google:callbackUrl'] || process.env.OAUTH_GOOGLE_CALLBACK_URI, // DEPRECATED: backward compatible with v3.2.3 and below
|
|
|
skipUserProfile: false,
|
|
|
}, function(accessToken, refreshToken, profile, done) {
|
|
|
@@ -359,7 +360,7 @@ class PassportService {
|
|
|
clientID: config.crowi['security:passport-github:clientId'] || process.env.OAUTH_GITHUB_CLIENT_ID,
|
|
|
clientSecret: config.crowi['security:passport-github:clientSecret'] || process.env.OAUTH_GITHUB_CLIENT_SECRET,
|
|
|
callbackURL: (this.crowi.configManager.getConfig('crowi', 'app:siteUrl') != null)
|
|
|
- ? `${this.crowi.configManager.getSiteUrl()}/passport/github/callback` // auto-generated with v3.2.4 and above
|
|
|
+ ? urljoin(this.crowi.configManager.getSiteUrl(), '/passport/github/callback') // auto-generated with v3.2.4 and above
|
|
|
: config.crowi['security:passport-github:callbackUrl'] || process.env.OAUTH_GITHUB_CALLBACK_URI, // DEPRECATED: backward compatible with v3.2.3 and below
|
|
|
skipUserProfile: false,
|
|
|
}, function(accessToken, refreshToken, profile, done) {
|
|
|
@@ -406,7 +407,7 @@ class PassportService {
|
|
|
consumerKey: config.crowi['security:passport-twitter:consumerKey'] || process.env.OAUTH_TWITTER_CONSUMER_KEY,
|
|
|
consumerSecret: config.crowi['security:passport-twitter:consumerSecret'] || process.env.OAUTH_TWITTER_CONSUMER_SECRET,
|
|
|
callbackURL: (this.crowi.configManager.getConfig('crowi', 'app:siteUrl') != null)
|
|
|
- ? `${this.crowi.configManager.getSiteUrl()}/passport/twitter/callback` // auto-generated with v3.2.4 and above
|
|
|
+ ? urljoin(this.crowi.configManager.getSiteUrl(), '/passport/twitter/callback') // auto-generated with v3.2.4 and above
|
|
|
: config.crowi['security:passport-twitter:callbackUrl'] || process.env.OAUTH_TWITTER_CALLBACK_URI, // DEPRECATED: backward compatible with v3.2.3 and below
|
|
|
skipUserProfile: false,
|
|
|
}, function(accessToken, refreshToken, profile, done) {
|
|
|
@@ -452,7 +453,7 @@ class PassportService {
|
|
|
passport.use(new SamlStrategy({
|
|
|
entryPoint: configManager.getConfig('crowi', 'security:passport-saml:entryPoint'),
|
|
|
callbackUrl: (this.crowi.configManager.getConfig('crowi', 'app:siteUrl') != null)
|
|
|
- ? `${this.crowi.configManager.getSiteUrl()}/passport/saml/callback` // auto-generated with v3.2.4 and above
|
|
|
+ ? urljoin(this.crowi.configManager.getSiteUrl(), '/passport/saml/callback') // auto-generated with v3.2.4 and above
|
|
|
: configManager.getConfig('crowi', 'security:passport-saml:callbackUrl'), // DEPRECATED: backward compatible with v3.2.3 and below
|
|
|
issuer: configManager.getConfig('crowi', 'security:passport-saml:issuer'),
|
|
|
cert: configManager.getConfig('crowi', 'security:passport-saml:cert'),
|