mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 06:34:39 -04:00
Add Google oauth variable: hostedDomain
Which is part of `passport-google-oauth2`. It could be used as whitelist to a domain supported by google oauth. Ref: https://github.com/jaredhanson/passport-google-oauth2/issues/3 Signed-off-by: ike <developer@ikewat.com>
This commit is contained in:
parent
b3d4cdbceb
commit
197223dc81
6 changed files with 9 additions and 5 deletions
|
@ -134,7 +134,7 @@ these are rarely used for various reasons.
|
||||||
|
|
||||||
| variables | example values | description |
|
| variables | example values | description |
|
||||||
| --------- | ------ | ----------- |
|
| --------- | ------ | ----------- |
|
||||||
| `google` | `{clientID: ..., clientSecret: ...}` | An object containing the client ID and the client secret obtained by the [Google API console](https://console.cloud.google.com/apis) |
|
| `google` | `{clientID: ..., clientSecret: ..., hostedDomain: ...}` | An object containing the client ID and the client secret obtained by the [Google API console](https://console.cloud.google.com/apis) |
|
||||||
|
|
||||||
### LDAP Login
|
### LDAP Login
|
||||||
|
|
||||||
|
|
|
@ -135,6 +135,7 @@ defaultNotePath can't be set from env-vars
|
||||||
| -------- | ------------- | ----------- |
|
| -------- | ------------- | ----------- |
|
||||||
| `CMD_GOOGLE_CLIENTID` | no example | Google API client id |
|
| `CMD_GOOGLE_CLIENTID` | no example | Google API client id |
|
||||||
| `CMD_GOOGLE_CLIENTSECRET` | no example | Google API client secret |
|
| `CMD_GOOGLE_CLIENTSECRET` | no example | Google API client secret |
|
||||||
|
| `CMD_GOOGLE_HOSTEDDOMAIN` | `example.com` | Provided only if the user belongs to a hosted domain. default is `undefined` |
|
||||||
|
|
||||||
|
|
||||||
### LDAP Login
|
### LDAP Login
|
||||||
|
|
|
@ -124,7 +124,8 @@ module.exports = {
|
||||||
},
|
},
|
||||||
google: {
|
google: {
|
||||||
clientID: undefined,
|
clientID: undefined,
|
||||||
clientSecret: undefined
|
clientSecret: undefined,
|
||||||
|
hostedDomain: undefined
|
||||||
},
|
},
|
||||||
ldap: {
|
ldap: {
|
||||||
providerName: undefined,
|
providerName: undefined,
|
||||||
|
|
|
@ -53,7 +53,8 @@ if (fs.existsSync(basePath)) {
|
||||||
},
|
},
|
||||||
google: {
|
google: {
|
||||||
clientID: getSecret('google_clientID'),
|
clientID: getSecret('google_clientID'),
|
||||||
clientSecret: getSecret('google_clientSecret')
|
clientSecret: getSecret('google_clientSecret'),
|
||||||
|
hostedDomain: getSecret('google_hostedDomain')
|
||||||
},
|
},
|
||||||
imgur: getSecret('imgur_clientid')
|
imgur: getSecret('imgur_clientid')
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,8 @@ module.exports = {
|
||||||
},
|
},
|
||||||
google: {
|
google: {
|
||||||
clientID: process.env.CMD_GOOGLE_CLIENTID,
|
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: {
|
ldap: {
|
||||||
providerName: process.env.CMD_LDAP_PROVIDERNAME,
|
providerName: process.env.CMD_LDAP_PROVIDERNAME,
|
||||||
|
|
|
@ -16,7 +16,7 @@ passport.use(new GoogleStrategy({
|
||||||
}, passportGeneralCallback))
|
}, passportGeneralCallback))
|
||||||
|
|
||||||
googleAuth.get('/auth/google', function (req, res, next) {
|
googleAuth.get('/auth/google', function (req, res, next) {
|
||||||
passport.authenticate('google', { scope: ['profile'] })(req, res, next)
|
passport.authenticate('google', { scope: ['profile'], hostedDomain: config.google.hostedDomain })(req, res, next)
|
||||||
})
|
})
|
||||||
// google auth callback
|
// google auth callback
|
||||||
googleAuth.get('/auth/google/callback',
|
googleAuth.get('/auth/google/callback',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue