Merge pull request #1426 from hackmdio/feat/support-google-hosted-name

Support hostedName in google OAuth provider
This commit is contained in:
Max Wu 2020-02-28 18:03:19 +08:00 committed by GitHub
commit c9badcf2e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View File

@ -17,7 +17,10 @@ passport.use(new GoogleStrategy({
googleAuth.get('/auth/google', function (req, res, next) {
setReturnToFromReferer(req)
passport.authenticate('google', { scope: ['profile'] })(req, res, next)
passport.authenticate('google', {
scope: ['profile'],
hostedDomain: config.google.hostedDomain
})(req, res, next)
})
// google auth callback
googleAuth.get('/auth/google/callback',

View File

@ -133,7 +133,8 @@ module.exports = {
},
google: {
clientID: undefined,
clientSecret: undefined
clientSecret: undefined,
hostedDomain: undefined
},
ldap: {
providerName: undefined,

View File

@ -105,7 +105,8 @@ module.exports = {
},
google: {
clientID: process.env.CMD_GOOGLE_CLIENTID,
clientSecret: process.env.CMD_GOOGLE_CLIENTSECRET
clientSecret: process.env.CMD_GOOGLE_CLIENTSECRET,
hostedDomain: process.env.CMD_GOOGLE_HOSTEDDOMAIN
},
ldap: {
providerName: process.env.CMD_LDAP_PROVIDERNAME,