scimgateway 4.2.0 → 4.2.1

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/README.md CHANGED
@@ -1165,6 +1165,14 @@ MIT © [Jarle Elshaug](https://www.elshaug.xyz)
1165
1165
 
1166
1166
  ## Change log
1167
1167
 
1168
+ ### v4.2.1
1169
+
1170
+ [Fixed]
1171
+
1172
+ - plugin-azure-ad createUser failed when manager was included
1173
+ - plugin-ldap slow when not using group/groupBase configuration
1174
+
1175
+
1168
1176
  ### v4.2.0
1169
1177
 
1170
1178
  [Added]
@@ -243,11 +243,15 @@ scimgateway.createUser = async (baseEntity, userObj, ctx) => {
243
243
  const action = 'createUser'
244
244
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" userObj=${JSON.stringify(userObj)}`)
245
245
 
246
- const attrObj = {}
246
+ const addonObj = {}
247
247
  if (userObj.servicePlan) {
248
- attrObj.servicePlan = userObj.servicePlan // will be included in a modifyuser
248
+ addonObj.servicePlan = userObj.servicePlan
249
249
  delete userObj.servicePlan
250
250
  }
251
+ if (userObj.manager) {
252
+ addonObj.manager = userObj.manager
253
+ delete userObj.manager
254
+ }
251
255
 
252
256
  const method = 'POST'
253
257
  const path = '/users'
@@ -255,8 +259,8 @@ scimgateway.createUser = async (baseEntity, userObj, ctx) => {
255
259
 
256
260
  try {
257
261
  await doRequest(baseEntity, method, path, body)
258
- if (attrObj.servicePlan) {
259
- await scimgateway.modifyUser(baseEntity, userObj.userName, attrObj, ctx)
262
+ if (Object.keys(addonObj).length > 0) {
263
+ await scimgateway.modifyUser(baseEntity, userObj.userName, addonObj, ctx) // manager, servicePlan
260
264
  return null
261
265
  } else return (null)
262
266
  } catch (err) {
@@ -240,7 +240,7 @@ scimgateway.getUsers = async (baseEntity, getObj, attributes, ctx) => {
240
240
 
241
241
  if (user.memberOf) {
242
242
  if (!config.map.group) user.memberOf = [] // empty any values
243
- else if (config.useSID_id || config.useGUID_id) { // Active Directory - convert memberOf having dn values to objectSid/objectGUID
243
+ if (config.useSID_id || config.useGUID_id) { // Active Directory - convert memberOf having dn values to objectSid/objectGUID
244
244
  const arr = []
245
245
  try {
246
246
  if (Array.isArray(user.memberOf)) {
@@ -261,7 +261,9 @@ scimgateway.getUsers = async (baseEntity, getObj, attributes, ctx) => {
261
261
  }
262
262
  }
263
263
 
264
- return scimgateway.endpointMapper('inbound', user, config.map.user)[0] // endpoint attribute naming => SCIM
264
+ const scimObj = scimgateway.endpointMapper('inbound', user, config.map.user)[0] // endpoint attribute naming => SCIM
265
+ if (!scimObj.groups) scimObj.groups = []
266
+ return scimObj
265
267
  }))
266
268
  } catch (err) {
267
269
  throw new Error(`${action} error: ${err.message}`)
@@ -509,8 +511,8 @@ scimgateway.getGroups = async (baseEntity, getObj, attributes, ctx) => {
509
511
  totalResults: null
510
512
  }
511
513
 
512
- if (!config.map.group) { // not using groups
513
- scimgateway.logger.debug(`${pluginName}[${baseEntity}] "${action}" stopped - missing configuration endpoint.map.group`)
514
+ if (!config.map.group || !config.entity[baseEntity].ldap.groupBase) { // not using groups
515
+ scimgateway.logger.debug(`${pluginName}[${baseEntity}] "${action}" stopped - missing configuration endpoint.map.group or groupBase`)
514
516
  return result
515
517
  }
516
518
 
@@ -1801,7 +1801,7 @@ const ScimGateway = function () {
1801
1801
  },
1802
1802
 
1803
1803
  // cleanup options
1804
- timeout: config.kubernetes?.forceExitTimeout || 1000, // [optional = 1000] number of milliseconds before forceful exiting
1804
+ timeout: config.kubernetes.forceExitTimeout || 1000, // [optional = 1000] number of milliseconds before forceful exiting
1805
1805
  beforeShutdown, // [optional] called before the HTTP server starts its shutdown
1806
1806
  onSignal, // [optional] cleanup function, returning a promise (used to be onSigterm)
1807
1807
  onShutdown // [optional] called right before exiting
@@ -2401,7 +2401,7 @@ ScimGateway.prototype.endpointMapper = function endpointMapper (direction, parse
2401
2401
  else dotKey = `${dotPath}.${key}`
2402
2402
  if (direction === 'outbound') { // outbound
2403
2403
  if (obj[key] === '') obj[key] = null
2404
- if (dotMap[dotKey] && dotMap[`${dotKey}.type`]) {
2404
+ if (dotMap[`${dotKey}.type`]) {
2405
2405
  const type = dotMap[`${dotKey}.type`].toLowerCase()
2406
2406
  if (type === 'boolean' && obj[key].constructor === String) {
2407
2407
  if ((obj[key]).toLowerCase() === 'true') obj[key] = true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scimgateway",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "description": "Using SCIM protocol as a gateway for user provisioning to other endpoints",
5
5
  "author": "Jarle Elshaug <jarle.elshaug@gmail.com> (https://elshaug.xyz)",
6
6
  "homepage": "https://elshaug.xyz",