@budibase/worker 1.2.57 → 1.2.58-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/worker",
3
3
  "email": "hi@budibase.com",
4
- "version": "1.2.57",
4
+ "version": "1.2.58-alpha.0",
5
5
  "description": "Budibase background service",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -35,10 +35,10 @@
35
35
  "author": "Budibase",
36
36
  "license": "GPL-3.0",
37
37
  "dependencies": {
38
- "@budibase/backend-core": "^1.2.57",
39
- "@budibase/pro": "1.2.56",
40
- "@budibase/string-templates": "^1.2.57",
41
- "@budibase/types": "^1.2.57",
38
+ "@budibase/backend-core": "1.2.58-alpha.0",
39
+ "@budibase/pro": "1.2.57",
40
+ "@budibase/string-templates": "1.2.58-alpha.0",
41
+ "@budibase/types": "1.2.58-alpha.0",
42
42
  "@koa/router": "8.0.8",
43
43
  "@sentry/node": "6.17.7",
44
44
  "@techpass/passport-openidconnect": "0.3.2",
@@ -102,5 +102,5 @@
102
102
  "./scripts/jestSetup.js"
103
103
  ]
104
104
  },
105
- "gitHead": "605b91baf8bed0f1ffbb2d3304d4525c866bdd77"
105
+ "gitHead": "8b6f73f3988363bc2dca66bf1eff240b663a61c4"
106
106
  }
@@ -227,9 +227,22 @@ export const oidcPreAuth = async (ctx: any, next: any) => {
227
227
 
228
228
  setCookie(ctx, configId, Cookies.OIDC_CONFIG)
229
229
 
230
+ const db = getGlobalDB()
231
+ const config = await core.db.getScopedConfig(db, {
232
+ type: Configs.OIDC,
233
+ group: ctx.query.group,
234
+ })
235
+
236
+ const chosenConfig = config.configs.filter((c: any) => c.uuid === configId)[0]
237
+
238
+ let authScopes =
239
+ chosenConfig.scopes?.length > 0
240
+ ? chosenConfig.scopes
241
+ : ["profile", "email", "offline_access"]
242
+
230
243
  return passport.authenticate(strategy, {
231
244
  // required 'openid' scope is added by oidc strategy factory
232
- scope: ["profile", "email", "offline_access"], //auth0 offline_access scope required for the refresh token behaviour.
245
+ scope: authScopes,
233
246
  })(ctx, next)
234
247
  }
235
248
 
@@ -53,6 +53,7 @@ function oidcValidation() {
53
53
  name: Joi.string().allow("", null),
54
54
  uuid: Joi.string().required(),
55
55
  activated: Joi.boolean().required(),
56
+ scopes: Joi.array().optional()
56
57
  })
57
58
  ).required(true)
58
59
  }).unknown(true)