scimgateway 5.2.3 → 5.2.5

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
@@ -175,7 +175,8 @@ Upgrade to latest minor version:
175
175
 
176
176
  Note, always backup/copy c:\\my-scimgateway before upgrading. Custom plugins and corresponding configuration files will not be affected.
177
177
 
178
- To force a major upgrade (version x.\*.\* => y.\*.\*) that will brake compability with any existing custom plugins, we have to include the `@latest` suffix in the install command: `bun install scimgateway@latest`
178
+ To force a major upgrade (version x.\*.\* => y.\*.\*) that will brake compability with any existing custom plugins, we have to include the `@latest` suffix in the install command:
179
+ `bun install scimgateway@latest`
179
180
 
180
181
  ##### Avoid (re-)adding the files created during `postinstall`
181
182
 
@@ -395,6 +396,8 @@ Definitions in `endpoint` object are customized according to our plugin code. Pl
395
396
 
396
397
  - **log.loglevel.push** - off, debug, info, warn or error. Default info. Push to stream that can be used by client subscriber
397
398
 
399
+ - **log.logDirectory** - custom defined log directory e.g. `/var/log/scimgateway` that will override default `<scimgateway path>/logs`. If not exist it will be created.
400
+
398
401
  - **log.customMasking** - array of attributes to be masked e.g. `"customMasking": ["SSN", "weight"]`. By default SCIM Gateway includes masking of some standard attributes like password.
399
402
 
400
403
  - **log.colorize** - default true, gives colorized and minimized console output, if redirected to stdout/stderr standard JSON formatted output and no colors. Set to false give standard JSON
@@ -1401,6 +1404,20 @@ MIT © [Jarle Elshaug](https://www.elshaug.xyz)
1401
1404
 
1402
1405
  ## Change log
1403
1406
 
1407
+ ### v5.2.5
1408
+
1409
+ [Fixed]
1410
+
1411
+ - endpointMapper (used by plugin-entra-id and plugin-ldap) in v5 when using mapping type=array, the first element was excluded on outbound mapping in some use cases
1412
+
1413
+ ### v5.2.4
1414
+
1415
+ [Improved]
1416
+
1417
+ - New configuration `log.logDirectory` for custom defined log directory e.g. `/var/log/scimgateway` that will override default `<scimgateway path>/logs`.
1418
+ **Thanks to [@Gerrit Lansing](https://github.com/gerritlansing)**
1419
+ - Base URL like `/scim/v1` and `/scim/v2` is now supported, also with baseEntity e.g. `/scim/v2/client1/Users`
1420
+
1404
1421
  ### v5.2.3
1405
1422
 
1406
1423
  [Fixed]
@@ -334,7 +334,6 @@ export class ScimGateway {
334
334
  const configFile = path.join(`${configDir}`, `${pluginName}.json`) // config name prefix same as pluging name prefix
335
335
  const gwName = path.basename(fileURLToPath(import.meta.url)).split('.')[0] // prefix of current file - using fileURLToPath because using "__filename" is not supported by nodejs typescript
336
336
  const gwPath = path.dirname(fileURLToPath(import.meta.url))
337
- const logDir = path.join(pluginDir, '..', 'logs')
338
337
 
339
338
  this.config = {}
340
339
  // exposed outside class
@@ -356,6 +355,7 @@ export class ScimGateway {
356
355
  found = this.processConfig()
357
356
  } catch (err) { configErr = err }
358
357
 
358
+ const logDir = this.config?.scimgateway?.log?.logDirectory || path.join(pluginDir, '..', 'logs')
359
359
  const logger = new Logger(
360
360
  pluginName,
361
361
  {
@@ -2174,7 +2174,13 @@ export class ScimGateway {
2174
2174
  const method = request.method
2175
2175
  const url = new URL(request.url)
2176
2176
 
2177
- let [, baseEntity, handle, id, rest]: string[] = url.pathname.split('/')
2177
+ let pathname = url.pathname
2178
+ const match = pathname.match(/.*\/scim\/v(1|2)(\/.*)/)
2179
+ if (match) {
2180
+ pathname = match[2] // the part after /scim/vX
2181
+ }
2182
+
2183
+ let [, baseEntity, handle, id, rest]: string[] = pathname.split('/')
2178
2184
  if (baseEntity && handlers.includes(baseEntity.toLowerCase())) {
2179
2185
  rest = id
2180
2186
  id = handle
package/lib/utils-scim.ts CHANGED
@@ -480,7 +480,7 @@ export function endpointMapper(direction: string, parseObj: any, mapObj: any) {
480
480
  if (dotMap[key2].split(',').map((item: string) => item.trim().toLowerCase()).includes(key.toLowerCase())) {
481
481
  found = true
482
482
  const keyRoot = key2.split('.').slice(0, -1).join('.') // xx.yy.mapTo => xx.yy
483
- if (dotMap[`${keyRoot}.type`] === 'array' && arrIndex && arrIndex >= 0) {
483
+ if (dotMap[`${keyRoot}.type`] === 'array' && arrIndex >= 0) {
484
484
  dotNewObj[`${keyRoot}.${arrIndex}`] = dotParse[keyOrg] // servicePlan.0.value => servicePlan.0 and groups[0].value => memberOf.0
485
485
  }
486
486
  dotNewObj[keyRoot] = dotParse[key] // {"accountEnabled": {"mapTo": "active"} => str.replace("accountEnabled", "active")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scimgateway",
3
- "version": "5.2.3",
3
+ "version": "5.2.5",
4
4
  "type": "module",
5
5
  "description": "Using SCIM protocol as a gateway for user provisioning to other endpoints",
6
6
  "author": "Jarle Elshaug <jarle.elshaug@gmail.com> (https://elshaug.xyz)",