scimgateway 4.1.14 → 4.1.15

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
@@ -261,7 +261,12 @@ Below shows an example of config\plugin-saphana.json
261
261
  "readOnly": false,
262
262
  "baseEntities": []
263
263
  }
264
- ]
264
+ ],
265
+ "passThrough": {
266
+ "enabled": false,
267
+ "readOnly": false,
268
+ "baseEntities": []
269
+ }
265
270
  },
266
271
  "certificate": {
267
272
  "key": null,
@@ -354,6 +359,8 @@ Definitions in `endpoint` object are customized according to our plugin code. Pl
354
359
 
355
360
  - **auth.bearerOAuth** - Array of one or more Client Credentials OAuth configuration objects. **`client_id`** and **`client_secret`** are mandatory. client_secret value will become encrypted when gateway is started. OAuth token request url is **/oauth/token** e.g. http://localhost:8880/oauth/token
356
361
 
362
+ - **auth.passThrough** - Setting **auth.passThrough.enabled=true** will bypass SCIM Gateway authentication. Gateway will instead pass ctx containing authentication header to the plugin. Plugin could then use this information for endpoint authentication and we don't have any password/token stored at the gateway. Note, this also requires plugin binary having `scimgateway.authPassThroughAllowed = true` and endpoint logic for handling/passing ctx.request.header.authorization
363
+
357
364
  - **certificate** - If not using TLS certificate, set "key", "cert" and "ca" to **null**. When using TLS, "key" and "cert" have to be defined with the filename corresponding to the primary-key and public-certificate. Both files must be located in the `<package-root>\config\certs` directory e.g:
358
365
 
359
366
  "certificate": {
@@ -1146,6 +1153,36 @@ MIT © [Jarle Elshaug](https://www.elshaug.xyz)
1146
1153
 
1147
1154
  ## Change log
1148
1155
 
1156
+ ### v4.1.15
1157
+
1158
+ [Added]
1159
+
1160
+ - authPassThrough for passing the authentication directly to plugin without being processed by scimgateway
1161
+
1162
+ Plugin configuration prerequisites: **auth.passThrough.enabled=true**
1163
+
1164
+ "auth": {
1165
+ ...
1166
+ "passThrough": {
1167
+ "enabled": true,
1168
+ "readOnly": false,
1169
+ "baseEntities": []
1170
+ }
1171
+ ...
1172
+ }
1173
+
1174
+ Plugin binary prerequisites:
1175
+
1176
+ scimgateway.authPassThroughAllowed = true
1177
+ // also need endpoint logic for handling/passing ctx.request.header.authorization
1178
+
1179
+
1180
+ For upgrading existing custom plugins, above mention prerequisites needs to be included and in addition all plugin methods must include the `ctx` parameter e.g.:
1181
+
1182
+ scimgateway.getUsers = async (baseEntity, getObj, attributes, ctx)
1183
+ // tip, see provided example plugins
1184
+
1185
+
1149
1186
  ### v4.1.14
1150
1187
 
1151
1188
  [Fixed]
@@ -57,7 +57,12 @@
57
57
  "readOnly": false,
58
58
  "baseEntities": []
59
59
  }
60
- ]
60
+ ],
61
+ "passThrough": {
62
+ "enabled": false,
63
+ "readOnly": false,
64
+ "baseEntities": []
65
+ }
61
66
  },
62
67
  "certificate": {
63
68
  "key": null,
@@ -87,7 +92,9 @@
87
92
  "endpoint": {
88
93
  "entity": {
89
94
  "undefined": {
90
- "baseUrls": ["http://fakerestapi.azurewebsites.net"],
95
+ "baseUrls": [
96
+ "http://fakerestapi.azurewebsites.net"
97
+ ],
91
98
  "username": "endpointuser",
92
99
  "password": "password",
93
100
  "proxy": {
@@ -57,7 +57,12 @@
57
57
  "readOnly": false,
58
58
  "baseEntities": []
59
59
  }
60
- ]
60
+ ],
61
+ "passThrough": {
62
+ "enabled": false,
63
+ "readOnly": false,
64
+ "baseEntities": []
65
+ }
61
66
  },
62
67
  "certificate": {
63
68
  "key": null,
@@ -57,7 +57,12 @@
57
57
  "readOnly": false,
58
58
  "baseEntities": []
59
59
  }
60
- ]
60
+ ],
61
+ "passThrough": {
62
+ "enabled": false,
63
+ "readOnly": false,
64
+ "baseEntities": []
65
+ }
61
66
  },
62
67
  "certificate": {
63
68
  "key": null,
@@ -57,7 +57,12 @@
57
57
  "readOnly": false,
58
58
  "baseEntities": []
59
59
  }
60
- ]
60
+ ],
61
+ "passThrough": {
62
+ "enabled": false,
63
+ "readOnly": false,
64
+ "baseEntities": []
65
+ }
61
66
  },
62
67
  "certificate": {
63
68
  "key": null,
@@ -57,7 +57,12 @@
57
57
  "readOnly": false,
58
58
  "baseEntities": []
59
59
  }
60
- ]
60
+ ],
61
+ "passThrough": {
62
+ "enabled": false,
63
+ "readOnly": false,
64
+ "baseEntities": []
65
+ }
61
66
  },
62
67
  "certificate": {
63
68
  "key": null,
@@ -63,7 +63,12 @@
63
63
  "readOnly": false,
64
64
  "baseEntities": []
65
65
  }
66
- ]
66
+ ],
67
+ "passThrough": {
68
+ "enabled": false,
69
+ "readOnly": false,
70
+ "baseEntities": []
71
+ }
67
72
  },
68
73
  "certificate": {
69
74
  "key": null,
@@ -57,7 +57,12 @@
57
57
  "readOnly": false,
58
58
  "baseEntities": []
59
59
  }
60
- ]
60
+ ],
61
+ "passThrough": {
62
+ "enabled": false,
63
+ "readOnly": false,
64
+ "baseEntities": []
65
+ }
61
66
  },
62
67
  "certificate": {
63
68
  "key": null,
@@ -57,7 +57,12 @@
57
57
  "readOnly": false,
58
58
  "baseEntities": []
59
59
  }
60
- ]
60
+ ],
61
+ "passThrough": {
62
+ "enabled": false,
63
+ "readOnly": false,
64
+ "baseEntities": []
65
+ }
61
66
  },
62
67
  "certificate": {
63
68
  "key": null,
@@ -57,7 +57,12 @@
57
57
  "readOnly": false,
58
58
  "baseEntities": []
59
59
  }
60
- ]
60
+ ],
61
+ "passThrough": {
62
+ "enabled": false,
63
+ "readOnly": false,
64
+ "baseEntities": []
65
+ }
61
66
  },
62
67
  "certificate": {
63
68
  "key": null,
@@ -87,7 +92,9 @@
87
92
  "endpoint": {
88
93
  "entity": {
89
94
  "undefined": {
90
- "baseUrls": ["http://localhost:8880"],
95
+ "baseUrls": [
96
+ "http://localhost:8880"
97
+ ],
91
98
  "scimVersion": "2.0",
92
99
  "username": "gwadmin",
93
100
  "password": "password",
@@ -98,7 +105,9 @@
98
105
  }
99
106
  },
100
107
  "clientA": {
101
- "baseUrls": ["http://localhost:8880"],
108
+ "baseUrls": [
109
+ "http://localhost:8880"
110
+ ],
102
111
  "scimVersion": "2.0",
103
112
  "username": "gwadmin",
104
113
  "password": "password",
package/lib/plugin-api.js CHANGED
@@ -46,6 +46,7 @@ const configDir = path.join(__dirname, '..', 'config')
46
46
  const configFile = path.join(`${configDir}`, `${pluginName}.json`)
47
47
  let config = require(configFile).endpoint
48
48
  config = scimgateway.processExtConfig(pluginName, config) // add any external config process.env and process.file
49
+ scimgateway.authPassThroughAllowed = false // true enables auth passThrough (no scimgateway authentication). scimgateway instead includes ctx (ctx.request.header) in plugin methods. Note, requires plugin-logic for handling/passing ctx.request.header.authorization to be used in endpoint communication
49
50
  // mandatory plugin initialization - end
50
51
 
51
52
  const _serviceClient = {}
@@ -58,7 +59,7 @@ const _serviceClient = {}
58
59
  // post http://localhost:8890/api
59
60
  // body = {"eventName":"AssignAccessRoleEvent","subjectName":"RACF_System-B","userID":"peter01"}
60
61
  //
61
- scimgateway.postApi = async (baseEntity, apiObj) => {
62
+ scimgateway.postApi = async (baseEntity, apiObj, ctx) => {
62
63
  const action = 'postApi'
63
64
  scimgateway.logger.debug(`${pluginName} handling "${action}" apiObj=${JSON.stringify(apiObj)}`)
64
65
 
@@ -92,7 +93,7 @@ scimgateway.postApi = async (baseEntity, apiObj) => {
92
93
  // put http://localhost:8890/api/1
93
94
  // body = {"eventName":"AssignAccessRoleEvent","subjectName":"RACF_System-B","userID":"peter01"}
94
95
  //
95
- scimgateway.putApi = async (baseEntity, id, apiObj) => {
96
+ scimgateway.putApi = async (baseEntity, id, apiObj, ctx) => {
96
97
  const action = 'putApi'
97
98
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" id=${id} apiObj=${JSON.stringify(apiObj)}`)
98
99
 
@@ -126,7 +127,7 @@ scimgateway.putApi = async (baseEntity, id, apiObj) => {
126
127
  // patch http://localhost:8890/api/1
127
128
  // body = {"eventName":"AssignAccessRoleEvent","subjectName":"RACF_System-B","userID":"peter01"}
128
129
  //
129
- scimgateway.patchApi = async (baseEntity, id, apiObj) => {
130
+ scimgateway.patchApi = async (baseEntity, id, apiObj, ctx) => {
130
131
  const action = 'patchApi'
131
132
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" id=${id} apiObj=${JSON.stringify(apiObj)}`)
132
133
 
@@ -160,7 +161,7 @@ scimgateway.patchApi = async (baseEntity, id, apiObj) => {
160
161
  // get http://localhost:8890/api/1
161
162
  // get http://localhost:8890/api?queries
162
163
  //
163
- scimgateway.getApi = async (baseEntity, id, apiQuery, apiObj) => {
164
+ scimgateway.getApi = async (baseEntity, id, apiQuery, apiObj, ctx) => {
164
165
  const action = 'getApi'
165
166
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" id=${id} apiQuery=${JSON.stringify(apiQuery)} apiObj=${JSON.stringify(apiObj)}`)
166
167
 
@@ -191,7 +192,7 @@ scimgateway.getApi = async (baseEntity, id, apiQuery, apiObj) => {
191
192
  // example:
192
193
  // delete http://localhost:8890/api/1
193
194
  //
194
- scimgateway.deleteApi = async (baseEntity, id) => {
195
+ scimgateway.deleteApi = async (baseEntity, id, ctx) => {
195
196
  const action = 'deleteApi'
196
197
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" id=${id}`)
197
198
 
@@ -87,6 +87,7 @@ const configDir = path.join(__dirname, '..', 'config')
87
87
  const configFile = path.join(`${configDir}`, `${pluginName}.json`)
88
88
  let config = require(configFile).endpoint
89
89
  config = scimgateway.processExtConfig(pluginName, config) // add any external config process.env and process.file
90
+ scimgateway.authPassThroughAllowed = false // true enables auth passThrough (no scimgateway authentication). scimgateway instead includes ctx (ctx.request.header) in plugin methods. Note, requires plugin-logic for handling/passing ctx.request.header.authorization to be used in endpoint communication
90
91
  // mandatory plugin initialization - end
91
92
 
92
93
  if (config.map) { // having licensDetails map here instead of config file
@@ -135,7 +136,7 @@ const lock = new scimgateway.Lock()
135
136
  // =================================================
136
137
  // getUsers
137
138
  // =================================================
138
- scimgateway.getUsers = async (baseEntity, getObj, attributes) => {
139
+ scimgateway.getUsers = async (baseEntity, getObj, attributes, ctx) => {
139
140
  //
140
141
  // "getObj" = { attribute: <>, operator: <>, value: <>, rawFilter: <>, startIndex: <>, count: <> }
141
142
  // rawFilter is always included when filtering
@@ -238,7 +239,7 @@ scimgateway.getUsers = async (baseEntity, getObj, attributes) => {
238
239
  // =================================================
239
240
  // createUser
240
241
  // =================================================
241
- scimgateway.createUser = async (baseEntity, userObj) => {
242
+ scimgateway.createUser = async (baseEntity, userObj, ctx) => {
242
243
  const action = 'createUser'
243
244
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" userObj=${JSON.stringify(userObj)}`)
244
245
 
@@ -255,7 +256,7 @@ scimgateway.createUser = async (baseEntity, userObj) => {
255
256
  try {
256
257
  await doRequest(baseEntity, method, path, body)
257
258
  if (attrObj.servicePlan) {
258
- await scimgateway.modifyUser(baseEntity, userObj.userName, attrObj)
259
+ await scimgateway.modifyUser(baseEntity, userObj.userName, attrObj, ctx)
259
260
  return null
260
261
  } else return (null)
261
262
  } catch (err) {
@@ -268,7 +269,7 @@ scimgateway.createUser = async (baseEntity, userObj) => {
268
269
  // =================================================
269
270
  // deleteUser
270
271
  // =================================================
271
- scimgateway.deleteUser = async (baseEntity, id) => {
272
+ scimgateway.deleteUser = async (baseEntity, id, ctx) => {
272
273
  const action = 'deleteUser'
273
274
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" id=${id}`)
274
275
  const method = 'DELETE'
@@ -285,7 +286,7 @@ scimgateway.deleteUser = async (baseEntity, id) => {
285
286
  // =================================================
286
287
  // modifyUser
287
288
  // =================================================
288
- scimgateway.modifyUser = async (baseEntity, id, attrObj) => {
289
+ scimgateway.modifyUser = async (baseEntity, id, attrObj, ctx) => {
289
290
  const action = 'modifyUser'
290
291
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" id=${id} attrObj=${JSON.stringify(attrObj)}`)
291
292
  const arrLicAdd = []
@@ -517,7 +518,7 @@ scimgateway.modifyUser = async (baseEntity, id, attrObj) => {
517
518
  // =================================================
518
519
  // getGroups
519
520
  // =================================================
520
- scimgateway.getGroups = async (baseEntity, getObj, attributes) => {
521
+ scimgateway.getGroups = async (baseEntity, getObj, attributes, ctx) => {
521
522
  //
522
523
  // "getObj" = { attribute: <>, operator: <>, value: <>, rawFilter: <>, startIndex: <>, count: <> }
523
524
  // rawFilter is always included when filtering
@@ -652,7 +653,7 @@ scimgateway.getGroups = async (baseEntity, getObj, attributes) => {
652
653
  // =================================================
653
654
  // createGroup
654
655
  // =================================================
655
- scimgateway.createGroup = async (baseEntity, groupObj) => {
656
+ scimgateway.createGroup = async (baseEntity, groupObj, ctx) => {
656
657
  const action = 'createGroup'
657
658
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" groupObj=${JSON.stringify(groupObj)}`)
658
659
  const body = { displayName: groupObj.displayName }
@@ -663,7 +664,7 @@ scimgateway.createGroup = async (baseEntity, groupObj) => {
663
664
  const path = '/Groups'
664
665
 
665
666
  try {
666
- const res = await scimgateway.getGroups(baseEntity, { attribute: 'displayName', operator: 'eq', value: groupObj.displayName }, ['id', 'displayName'])
667
+ const res = await scimgateway.getGroups(baseEntity, { attribute: 'displayName', operator: 'eq', value: groupObj.displayName }, ['id', 'displayName'], ctx)
667
668
  if (res && res.Resources && res.Resources.length > 0) {
668
669
  throw new Error(`group ${groupObj.displayName} already exist`)
669
670
  }
@@ -679,7 +680,7 @@ scimgateway.createGroup = async (baseEntity, groupObj) => {
679
680
  // =================================================
680
681
  // deleteGroup
681
682
  // =================================================
682
- scimgateway.deleteGroup = async (baseEntity, id) => {
683
+ scimgateway.deleteGroup = async (baseEntity, id, ctx) => {
683
684
  const action = 'deleteGroup'
684
685
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" id=${id}`)
685
686
  throw new Error(`${action} error: ${action} is not supported`)
@@ -688,7 +689,7 @@ scimgateway.deleteGroup = async (baseEntity, id) => {
688
689
  // =================================================
689
690
  // modifyGroup
690
691
  // =================================================
691
- scimgateway.modifyGroup = async (baseEntity, id, attrObj) => {
692
+ scimgateway.modifyGroup = async (baseEntity, id, attrObj, ctx) => {
692
693
  const action = 'modifyGroup'
693
694
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" id=${id} attrObj=${JSON.stringify(attrObj)}`)
694
695
 
@@ -755,7 +756,7 @@ scimgateway.modifyGroup = async (baseEntity, id, attrObj) => {
755
756
  // =================================================
756
757
  // getServicePlans
757
758
  // =================================================
758
- scimgateway.getServicePlans = async (baseEntity, getObj, attributes) => {
759
+ scimgateway.getServicePlans = async (baseEntity, getObj, attributes, ctx) => {
759
760
  //
760
761
  // "getObj" = { attribute: <>, operator: <>, value: <>, rawFilter: <>, startIndex: <>, count: <> }
761
762
  // rawFilter is always included when filtering - attribute, operator and value are included when requesting unique object or simpel filtering
@@ -875,7 +876,7 @@ scimgateway.getServicePlans = async (baseEntity, getObj, attributes) => {
875
876
  // =================================================
876
877
  // createServicePlan
877
878
  // =================================================
878
- scimgateway.createServicePlan = async (baseEntity, id) => {
879
+ scimgateway.createServicePlan = async (baseEntity, id, ctx) => {
879
880
  const action = 'createServicePlan'
880
881
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" id=${id}`)
881
882
  throw new Error(`${action} error: ${action} is not supported`)
@@ -884,7 +885,7 @@ scimgateway.createServicePlan = async (baseEntity, id) => {
884
885
  // =================================================
885
886
  // deleteServicePlan
886
887
  // =================================================
887
- scimgateway.deleteServicePlan = async (baseEntity, id) => {
888
+ scimgateway.deleteServicePlan = async (baseEntity, id, ctx) => {
888
889
  const action = 'deleteServicePlan'
889
890
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" id=${id}`)
890
891
  throw new Error(`${action} error: ${action} is not supported`)
@@ -893,7 +894,7 @@ scimgateway.deleteServicePlan = async (baseEntity, id) => {
893
894
  // =================================================
894
895
  // modifyServicePlan
895
896
  // =================================================
896
- scimgateway.modifyServicePlan = async (baseEntity, id) => {
897
+ scimgateway.modifyServicePlan = async (baseEntity, id, ctx) => {
897
898
  const action = 'modifyServicePlan'
898
899
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" id=${id}`)
899
900
  throw new Error(`${action} error: ${action} is not supported`)
@@ -59,6 +59,7 @@ const validScimAttr = [ // array containing scim attributes supported by our plu
59
59
  ]
60
60
  let config = require(configFile).endpoint
61
61
  config = scimgateway.processExtConfig(pluginName, config) // add any external config process.env and process.file
62
+ scimgateway.authPassThroughAllowed = false // true enables auth passThrough (no scimgateway authentication). scimgateway instead includes ctx (ctx.request.header) in plugin methods. Note, requires plugin-logic for handling/passing ctx.request.header.authorization to be used in endpoint communication
62
63
  // mandatory plugin initialization - end
63
64
 
64
65
  const wsdlDir = path.join(`${configDir}`, 'wsdls')
@@ -69,7 +70,7 @@ const _serviceClient = {}
69
70
  // =================================================
70
71
  // getUsers
71
72
  // =================================================
72
- scimgateway.getUsers = async (baseEntity, getObj, attributes) => {
73
+ scimgateway.getUsers = async (baseEntity, getObj, attributes, ctx) => {
73
74
  //
74
75
  // "getObj" = { attribute: <>, operator: <>, value: <>, rawFilter: <>, startIndex: <>, count: <> }
75
76
  // rawFilter is always included when filtering
@@ -192,7 +193,7 @@ scimgateway.getUsers = async (baseEntity, getObj, attributes) => {
192
193
  // =================================================
193
194
  // createUser
194
195
  // =================================================
195
- scimgateway.createUser = async (baseEntity, userObj) => {
196
+ scimgateway.createUser = async (baseEntity, userObj, ctx) => {
196
197
  const action = 'createUser'
197
198
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" userObj=${JSON.stringify(userObj)}`)
198
199
  try {
@@ -241,7 +242,7 @@ scimgateway.createUser = async (baseEntity, userObj) => {
241
242
  // =================================================
242
243
  // deleteUser
243
244
  // =================================================
244
- scimgateway.deleteUser = async (baseEntity, id) => {
245
+ scimgateway.deleteUser = async (baseEntity, id, ctx) => {
245
246
  const action = 'deleteUser'
246
247
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" id=${id}`)
247
248
  try {
@@ -268,7 +269,7 @@ scimgateway.deleteUser = async (baseEntity, id) => {
268
269
  // =================================================
269
270
  // modifyUser
270
271
  // =================================================
271
- scimgateway.modifyUser = async (baseEntity, id, attrObj) => {
272
+ scimgateway.modifyUser = async (baseEntity, id, attrObj, ctx) => {
272
273
  const action = 'modifyUser'
273
274
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" id=${id} attrObj=${JSON.stringify(attrObj)}`)
274
275
  try {
@@ -281,7 +282,7 @@ scimgateway.modifyUser = async (baseEntity, id, attrObj) => {
281
282
  value: id
282
283
  }
283
284
 
284
- const res = await scimgateway.getUsers(baseEntity, getObj, '')
285
+ const res = await scimgateway.getUsers(baseEntity, getObj, '', ctx)
285
286
 
286
287
  let userObj
287
288
  if (res && Array.isArray(res.Resources) && res.Resources.length === 1) userObj = res.Resources[0]
@@ -342,7 +343,7 @@ scimgateway.modifyUser = async (baseEntity, id, attrObj) => {
342
343
  // =================================================
343
344
  // getGroups
344
345
  // =================================================
345
- scimgateway.getGroups = async (baseEntity, getObj, attributes) => {
346
+ scimgateway.getGroups = async (baseEntity, getObj, attributes, ctx) => {
346
347
  //
347
348
  // "getObj" = { attribute: <>, operator: <>, value: <>, rawFilter: <>, startIndex: <>, count: <> }
348
349
  // rawFilter is always included when filtering
@@ -448,7 +449,7 @@ scimgateway.getGroups = async (baseEntity, getObj, attributes) => {
448
449
  // =================================================
449
450
  // createGroup
450
451
  // =================================================
451
- scimgateway.createGroup = async (baseEntity, groupObj) => {
452
+ scimgateway.createGroup = async (baseEntity, groupObj, ctx) => {
452
453
  const action = 'createGroup'
453
454
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" groupObj=${JSON.stringify(groupObj)}`)
454
455
  // groupObj.displayName contains the group to be created
@@ -459,7 +460,7 @@ scimgateway.createGroup = async (baseEntity, groupObj) => {
459
460
  // =================================================
460
461
  // deleteGroup
461
462
  // =================================================
462
- scimgateway.deleteGroup = async (baseEntity, id) => {
463
+ scimgateway.deleteGroup = async (baseEntity, id, ctx) => {
463
464
  const action = 'deleteGroup'
464
465
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" id=${id}`)
465
466
  // if supporting delete group, we need some endpoint logic here
@@ -469,7 +470,7 @@ scimgateway.deleteGroup = async (baseEntity, id) => {
469
470
  // =================================================
470
471
  // modifyGroup
471
472
  // =================================================
472
- scimgateway.modifyGroup = async (baseEntity, id, attrObj) => {
473
+ scimgateway.modifyGroup = async (baseEntity, id, attrObj, ctx) => {
473
474
  const action = 'modifyGroup'
474
475
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" id=${id} attrObj=${JSON.stringify(attrObj)}`)
475
476
 
@@ -85,6 +85,7 @@ const configDir = path.join(__dirname, '..', 'config')
85
85
  const configFile = path.join(`${configDir}`, `${pluginName}.json`)
86
86
  let config = require(configFile).endpoint
87
87
  config = scimgateway.processExtConfig(pluginName, config) // add any external config process.env and process.file
88
+ scimgateway.authPassThroughAllowed = false // true enables auth passThrough (no scimgateway authentication). scimgateway instead includes ctx (ctx.request.header) in plugin methods. Note, requires plugin-logic for handling/passing ctx.request.header.authorization to be used in endpoint communication
88
89
  // mandatory plugin initialization - end
89
90
 
90
91
  const _serviceClient = {}
@@ -123,7 +124,7 @@ if (config.map.user.userPrincipalName && config.map.user.userPrincipalName.mapDo
123
124
  // =================================================
124
125
  // getUsers
125
126
  // =================================================
126
- scimgateway.getUsers = async (baseEntity, getObj, attributes) => {
127
+ scimgateway.getUsers = async (baseEntity, getObj, attributes, ctx) => {
127
128
  //
128
129
  // "getObj" = { attribute: <>, operator: <>, value: <>, rawFilter: <>, startIndex: <>, count: <> }
129
130
  // rawFilter is always included when filtering
@@ -272,7 +273,7 @@ scimgateway.getUsers = async (baseEntity, getObj, attributes) => {
272
273
  // =================================================
273
274
  // createUser
274
275
  // =================================================
275
- scimgateway.createUser = async (baseEntity, userObj) => {
276
+ scimgateway.createUser = async (baseEntity, userObj, ctx) => {
276
277
  const action = 'createUser'
277
278
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" userObj=${JSON.stringify(userObj)}`)
278
279
 
@@ -331,7 +332,7 @@ scimgateway.createUser = async (baseEntity, userObj) => {
331
332
  // =================================================
332
333
  // deleteUser
333
334
  // =================================================
334
- scimgateway.deleteUser = async (baseEntity, id) => {
335
+ scimgateway.deleteUser = async (baseEntity, id, ctx) => {
335
336
  const action = 'deleteUser'
336
337
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" id=${id}`)
337
338
 
@@ -358,7 +359,7 @@ scimgateway.deleteUser = async (baseEntity, id) => {
358
359
  // =================================================
359
360
  // modifyUser
360
361
  // =================================================
361
- scimgateway.modifyUser = async (baseEntity, id, attrObj) => {
362
+ scimgateway.modifyUser = async (baseEntity, id, attrObj, ctx) => {
362
363
  const action = 'modifyUser'
363
364
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" id=${id} attrObj=${JSON.stringify(attrObj)}`)
364
365
 
@@ -423,7 +424,7 @@ scimgateway.modifyUser = async (baseEntity, id, attrObj) => {
423
424
  // endpoint spesific attribute handling
424
425
  if (endpointObj.userAccountControl !== undefined) { // SCIM "active" - Active Directory
425
426
  // can't use getUser because there is "active" logic overriding original userAccountControl that we want
426
- // const usr = await scimgateway.getUser(baseEntity, { filter: 'id', identifier: id }, 'active')
427
+ // const usr = await scimgateway.getUser(baseEntity, { filter: 'id', identifier: id }, 'active', ctx)
427
428
  const activeAttr = 'userAccountControl'
428
429
  const method = 'search'
429
430
  let base
@@ -487,7 +488,7 @@ scimgateway.modifyUser = async (baseEntity, id, attrObj) => {
487
488
  // =================================================
488
489
  // getGroups
489
490
  // =================================================
490
- scimgateway.getGroups = async (baseEntity, getObj, attributes) => {
491
+ scimgateway.getGroups = async (baseEntity, getObj, attributes, ctx) => {
491
492
  //
492
493
  // "getObj" = { attribute: <>, operator: <>, value: <>, rawFilter: <>, startIndex: <>, count: <> }
493
494
  // rawFilter is always included when filtering
@@ -633,7 +634,7 @@ scimgateway.getGroups = async (baseEntity, getObj, attributes) => {
633
634
  // =================================================
634
635
  // createGroup
635
636
  // =================================================
636
- scimgateway.createGroup = async (baseEntity, groupObj) => {
637
+ scimgateway.createGroup = async (baseEntity, groupObj, ctx) => {
637
638
  const action = 'createGroup'
638
639
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" groupObj=${JSON.stringify(groupObj)}`)
639
640
 
@@ -663,7 +664,7 @@ scimgateway.createGroup = async (baseEntity, groupObj) => {
663
664
  // =================================================
664
665
  // deleteGroup
665
666
  // =================================================
666
- scimgateway.deleteGroup = async (baseEntity, id) => {
667
+ scimgateway.deleteGroup = async (baseEntity, id, ctx) => {
667
668
  const action = 'deleteGroup'
668
669
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" id=${id}`)
669
670
 
@@ -691,7 +692,7 @@ scimgateway.deleteGroup = async (baseEntity, id) => {
691
692
  // =================================================
692
693
  // modifyGroup
693
694
  // =================================================
694
- scimgateway.modifyGroup = async (baseEntity, id, attrObj) => {
695
+ scimgateway.modifyGroup = async (baseEntity, id, attrObj, ctx) => {
695
696
  const action = 'modifyGroup'
696
697
  scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" id=${id} attrObj=${JSON.stringify(attrObj)}`)
697
698