@itentialopensource/adapter-okta 0.2.0 → 0.3.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/CALLS.md +1566 -0
- package/CHANGELOG.md +16 -0
- package/CONTRIBUTING.md +1 -160
- package/ENHANCE.md +2 -2
- package/README.md +32 -23
- package/adapter.js +161 -333
- package/adapterBase.js +549 -879
- package/changelogs/changelog.md +16 -0
- package/metadata.json +49 -0
- package/package.json +24 -27
- package/pronghorn.json +981 -642
- package/propertiesSchema.json +431 -31
- package/refs?service=git-upload-pack +0 -0
- package/report/adapter-openapi.json +22861 -0
- package/report/adapter-openapi.yaml +15054 -0
- package/report/adapterInfo.json +8 -8
- package/report/updateReport1691508740078.json +120 -0
- package/report/updateReport1692203198064.json +120 -0
- package/report/updateReport1694468322367.json +120 -0
- package/report/updateReport1698422603278.json +120 -0
- package/sampleProperties.json +63 -2
- package/test/integration/adapterTestBasicGet.js +2 -4
- package/test/integration/adapterTestConnectivity.js +91 -42
- package/test/integration/adapterTestIntegration.js +130 -2
- package/test/unit/adapterBaseTestUnit.js +388 -313
- package/test/unit/adapterTestUnit.js +338 -112
- package/utils/adapterInfo.js +1 -1
- package/utils/addAuth.js +1 -1
- package/utils/artifactize.js +1 -1
- package/utils/checkMigrate.js +1 -1
- package/utils/entitiesToDB.js +2 -2
- package/utils/findPath.js +1 -1
- package/utils/methodDocumentor.js +273 -0
- package/utils/modify.js +13 -15
- package/utils/packModificationScript.js +1 -1
- package/utils/pre-commit.sh +2 -0
- package/utils/taskMover.js +309 -0
- package/utils/tbScript.js +89 -34
- package/utils/tbUtils.js +41 -21
- package/utils/testRunner.js +1 -1
- package/utils/troubleshootingAdapter.js +9 -6
- package/workflows/README.md +0 -3
package/adapter.js
CHANGED
|
@@ -86,9 +86,6 @@ class Okta extends AdapterBaseCl {
|
|
|
86
86
|
let myIgnore = [
|
|
87
87
|
'healthCheck',
|
|
88
88
|
'iapGetAdapterWorkflowFunctions',
|
|
89
|
-
'iapHasAdapterEntity',
|
|
90
|
-
'iapVerifyAdapterCapability',
|
|
91
|
-
'iapUpdateAdapterEntityCache',
|
|
92
89
|
'hasEntities',
|
|
93
90
|
'getAuthorization'
|
|
94
91
|
];
|
|
@@ -116,29 +113,15 @@ class Okta extends AdapterBaseCl {
|
|
|
116
113
|
* @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
|
|
117
114
|
* @param {string} type - the type of entity file to change, (action, schema, mock) (optional)
|
|
118
115
|
* @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
|
|
116
|
+
* @param {boolean} replace - true to replace entire mock data, false to merge/append
|
|
119
117
|
* @param {Callback} callback - The results of the call
|
|
120
118
|
*/
|
|
121
|
-
iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
|
|
119
|
+
iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback) {
|
|
122
120
|
const meth = 'adapter-iapUpdateAdapterConfiguration';
|
|
123
121
|
const origin = `${this.id}-${meth}`;
|
|
124
122
|
log.trace(origin);
|
|
125
123
|
|
|
126
|
-
super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* See if the API path provided is found in this adapter
|
|
131
|
-
*
|
|
132
|
-
* @function iapFindAdapterPath
|
|
133
|
-
* @param {string} apiPath - the api path to check on
|
|
134
|
-
* @param {Callback} callback - The results of the call
|
|
135
|
-
*/
|
|
136
|
-
iapFindAdapterPath(apiPath, callback) {
|
|
137
|
-
const meth = 'adapter-iapFindAdapterPath';
|
|
138
|
-
const origin = `${this.id}-${meth}`;
|
|
139
|
-
log.trace(origin);
|
|
140
|
-
|
|
141
|
-
super.iapFindAdapterPath(apiPath, callback);
|
|
124
|
+
super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback);
|
|
142
125
|
}
|
|
143
126
|
|
|
144
127
|
/**
|
|
@@ -180,7 +163,7 @@ class Okta extends AdapterBaseCl {
|
|
|
180
163
|
}
|
|
181
164
|
|
|
182
165
|
/**
|
|
183
|
-
* @summary Get the
|
|
166
|
+
* @summary Get the Adapter Queue
|
|
184
167
|
*
|
|
185
168
|
* @function iapGetAdapterQueue
|
|
186
169
|
* @param {Callback} callback - callback function
|
|
@@ -193,6 +176,22 @@ class Okta extends AdapterBaseCl {
|
|
|
193
176
|
return super.iapGetAdapterQueue(callback);
|
|
194
177
|
}
|
|
195
178
|
|
|
179
|
+
/* SCRIPT CALLS */
|
|
180
|
+
/**
|
|
181
|
+
* See if the API path provided is found in this adapter
|
|
182
|
+
*
|
|
183
|
+
* @function iapFindAdapterPath
|
|
184
|
+
* @param {string} apiPath - the api path to check on
|
|
185
|
+
* @param {Callback} callback - The results of the call
|
|
186
|
+
*/
|
|
187
|
+
iapFindAdapterPath(apiPath, callback) {
|
|
188
|
+
const meth = 'adapter-iapFindAdapterPath';
|
|
189
|
+
const origin = `${this.id}-${meth}`;
|
|
190
|
+
log.trace(origin);
|
|
191
|
+
|
|
192
|
+
super.iapFindAdapterPath(apiPath, callback);
|
|
193
|
+
}
|
|
194
|
+
|
|
196
195
|
/**
|
|
197
196
|
* @summary Runs troubleshoot scripts for adapter
|
|
198
197
|
*
|
|
@@ -293,176 +292,93 @@ class Okta extends AdapterBaseCl {
|
|
|
293
292
|
}
|
|
294
293
|
}
|
|
295
294
|
|
|
296
|
-
/* BROKER CALLS */
|
|
297
295
|
/**
|
|
298
|
-
* @summary
|
|
296
|
+
* @summary Deactivate adapter tasks
|
|
299
297
|
*
|
|
300
|
-
* @function
|
|
301
|
-
* @param {String} entityType - the entity type to check for
|
|
302
|
-
* @param {String/Array} entityId - the specific entity we are looking for
|
|
298
|
+
* @function iapDeactivateTasks
|
|
303
299
|
*
|
|
304
|
-
* @param {
|
|
305
|
-
*
|
|
300
|
+
* @param {Array} tasks - List of tasks to deactivate
|
|
301
|
+
* @param {Callback} callback
|
|
306
302
|
*/
|
|
307
|
-
|
|
308
|
-
const
|
|
303
|
+
iapDeactivateTasks(tasks, callback) {
|
|
304
|
+
const meth = 'adapter-iapDeactivateTasks';
|
|
305
|
+
const origin = `${this.id}-${meth}`;
|
|
309
306
|
log.trace(origin);
|
|
310
307
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
308
|
+
try {
|
|
309
|
+
return super.iapDeactivateTasks(tasks, callback);
|
|
310
|
+
} catch (err) {
|
|
311
|
+
log.error(`${origin}: ${err}`);
|
|
312
|
+
return callback(null, err);
|
|
313
|
+
}
|
|
314
314
|
}
|
|
315
315
|
|
|
316
316
|
/**
|
|
317
|
-
* @summary
|
|
318
|
-
* whether the adapter supports type, action and specific entity
|
|
317
|
+
* @summary Activate adapter tasks that have previously been deactivated
|
|
319
318
|
*
|
|
320
|
-
* @function
|
|
321
|
-
*
|
|
322
|
-
* @param {
|
|
323
|
-
* @param {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
const meth = 'adapterBase-iapVerifyAdapterCapability';
|
|
330
|
-
const origin = `${this.id}-${meth}`;
|
|
331
|
-
log.trace(origin);
|
|
332
|
-
|
|
333
|
-
// if caching
|
|
334
|
-
if (this.caching) {
|
|
335
|
-
// Make the call - iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
|
|
336
|
-
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (results, error) => {
|
|
337
|
-
if (error) {
|
|
338
|
-
return callback(null, error);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
// if the cache needs to be updated, update and try again
|
|
342
|
-
if (results && results[0] === 'needupdate') {
|
|
343
|
-
switch (entityType) {
|
|
344
|
-
case 'template_entity': {
|
|
345
|
-
// if the cache is invalid, update the cache
|
|
346
|
-
return this.getEntities(null, null, null, null, (data, err) => {
|
|
347
|
-
if (err) {
|
|
348
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
|
|
349
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
350
|
-
return callback(null, errorObj);
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
// need to check the cache again since it has been updated
|
|
354
|
-
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (vcapable, verror) => {
|
|
355
|
-
if (verror) {
|
|
356
|
-
return callback(null, verror);
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
return this.capabilityResults(vcapable, callback);
|
|
360
|
-
});
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
default: {
|
|
364
|
-
// unsupported entity type
|
|
365
|
-
const result = [false];
|
|
366
|
-
|
|
367
|
-
// put false in array for all entities
|
|
368
|
-
if (Array.isArray(entityId)) {
|
|
369
|
-
for (let e = 1; e < entityId.length; e += 1) {
|
|
370
|
-
result.push(false);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
return callback(result);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
// return the results
|
|
380
|
-
return this.capabilityResults(results, callback);
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
// if no entity id
|
|
385
|
-
if (!entityId) {
|
|
386
|
-
// need to check the cache again since it has been updated
|
|
387
|
-
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
|
|
388
|
-
if (verror) {
|
|
389
|
-
return callback(null, verror);
|
|
390
|
-
}
|
|
319
|
+
* @function iapActivateTasks
|
|
320
|
+
*
|
|
321
|
+
* @param {Array} tasks - List of tasks to activate
|
|
322
|
+
* @param {Callback} callback
|
|
323
|
+
*/
|
|
324
|
+
iapActivateTasks(tasks, callback) {
|
|
325
|
+
const meth = 'adapter-iapActivateTasks';
|
|
326
|
+
const origin = `${this.id}-${meth}`;
|
|
327
|
+
log.trace(origin);
|
|
391
328
|
|
|
392
|
-
|
|
393
|
-
|
|
329
|
+
try {
|
|
330
|
+
return super.iapActivateTasks(tasks, callback);
|
|
331
|
+
} catch (err) {
|
|
332
|
+
log.error(`${origin}: ${err}`);
|
|
333
|
+
return callback(null, err);
|
|
394
334
|
}
|
|
335
|
+
}
|
|
395
336
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
return callback(null, verror);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
// is the entity in the list?
|
|
414
|
-
const isEntity = this.entityInList(entityId, data.response, callback);
|
|
415
|
-
const res = [];
|
|
416
|
-
|
|
417
|
-
// not found
|
|
418
|
-
for (let i = 0; i < isEntity.length; i += 1) {
|
|
419
|
-
if (vcapable) {
|
|
420
|
-
res.push(isEntity[i]);
|
|
421
|
-
} else {
|
|
422
|
-
res.push(false);
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
return callback(res);
|
|
427
|
-
});
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
default: {
|
|
431
|
-
// unsupported entity type
|
|
432
|
-
const result = [false];
|
|
433
|
-
|
|
434
|
-
// put false in array for all entities
|
|
435
|
-
if (Array.isArray(entityId)) {
|
|
436
|
-
for (let e = 1; e < entityId.length; e += 1) {
|
|
437
|
-
result.push(false);
|
|
438
|
-
}
|
|
439
|
-
}
|
|
337
|
+
/* CACHE CALLS */
|
|
338
|
+
/**
|
|
339
|
+
* @summary Populate the cache for the given entities
|
|
340
|
+
*
|
|
341
|
+
* @function iapPopulateEntityCache
|
|
342
|
+
* @param {String/Array of Strings} entityType - the entity type(s) to populate
|
|
343
|
+
* @param {Callback} callback - whether the cache was updated or not for each entity type
|
|
344
|
+
*
|
|
345
|
+
* @returns status of the populate
|
|
346
|
+
*/
|
|
347
|
+
iapPopulateEntityCache(entityTypes, callback) {
|
|
348
|
+
const meth = 'adapter-iapPopulateEntityCache';
|
|
349
|
+
const origin = `${this.id}-${meth}`;
|
|
350
|
+
log.trace(origin);
|
|
440
351
|
|
|
441
|
-
|
|
442
|
-
|
|
352
|
+
try {
|
|
353
|
+
return super.iapPopulateEntityCache(entityTypes, callback);
|
|
354
|
+
} catch (err) {
|
|
355
|
+
log.error(`${origin}: ${err}`);
|
|
356
|
+
return callback(null, err);
|
|
443
357
|
}
|
|
444
358
|
}
|
|
445
359
|
|
|
446
360
|
/**
|
|
447
|
-
* @summary
|
|
448
|
-
*
|
|
449
|
-
* @function iapUpdateAdapterEntityCache
|
|
361
|
+
* @summary Retrieves data from cache for specified entity type
|
|
450
362
|
*
|
|
363
|
+
* @function iapRetrieveEntitiesCache
|
|
364
|
+
* @param {String} entityType - entity of which to retrieve
|
|
365
|
+
* @param {Object} options - settings of which data to return and how to return it
|
|
366
|
+
* @param {Callback} callback - the data if it was retrieved
|
|
451
367
|
*/
|
|
452
|
-
|
|
453
|
-
const
|
|
368
|
+
iapRetrieveEntitiesCache(entityType, options, callback) {
|
|
369
|
+
const meth = 'adapter-iapCheckEiapRetrieveEntitiesCachentityCached';
|
|
370
|
+
const origin = `${this.id}-${meth}`;
|
|
454
371
|
log.trace(origin);
|
|
455
372
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
}
|
|
462
|
-
});
|
|
373
|
+
try {
|
|
374
|
+
return super.iapRetrieveEntitiesCache(entityType, options, callback);
|
|
375
|
+
} catch (err) {
|
|
376
|
+
log.error(`${origin}: ${err}`);
|
|
377
|
+
return callback(null, err);
|
|
463
378
|
}
|
|
464
379
|
}
|
|
465
380
|
|
|
381
|
+
/* BROKER CALLS */
|
|
466
382
|
/**
|
|
467
383
|
* @summary Determines if this adapter supports any in a list of entities
|
|
468
384
|
*
|
|
@@ -597,6 +513,38 @@ class Okta extends AdapterBaseCl {
|
|
|
597
513
|
}
|
|
598
514
|
|
|
599
515
|
/* GENERIC ADAPTER REQUEST - allows extension of adapter without new calls being added */
|
|
516
|
+
/**
|
|
517
|
+
* Makes the requested generic call
|
|
518
|
+
*
|
|
519
|
+
* @function iapExpandedGenericAdapterRequest
|
|
520
|
+
* @param {Object} metadata - metadata for the call (optional).
|
|
521
|
+
* Can be a stringified Object.
|
|
522
|
+
* @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (optional)
|
|
523
|
+
* @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (optional)
|
|
524
|
+
* @param {Object} pathVars - the parameters to be put within the url path (optional).
|
|
525
|
+
* Can be a stringified Object.
|
|
526
|
+
* @param {Object} queryData - the parameters to be put on the url (optional).
|
|
527
|
+
* Can be a stringified Object.
|
|
528
|
+
* @param {Object} requestBody - the body to add to the request (optional).
|
|
529
|
+
* Can be a stringified Object.
|
|
530
|
+
* @param {Object} addlHeaders - additional headers to be put on the call (optional).
|
|
531
|
+
* Can be a stringified Object.
|
|
532
|
+
* @param {getCallback} callback - a callback function to return the result (Generics)
|
|
533
|
+
* or the error
|
|
534
|
+
*/
|
|
535
|
+
iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback) {
|
|
536
|
+
const meth = 'adapter-iapExpandedGenericAdapterRequest';
|
|
537
|
+
const origin = `${this.id}-${meth}`;
|
|
538
|
+
log.trace(origin);
|
|
539
|
+
|
|
540
|
+
try {
|
|
541
|
+
return super.iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback);
|
|
542
|
+
} catch (err) {
|
|
543
|
+
log.error(`${origin}: ${err}`);
|
|
544
|
+
return callback(null, err);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
600
548
|
/**
|
|
601
549
|
* Makes the requested generic call
|
|
602
550
|
*
|
|
@@ -617,93 +565,11 @@ class Okta extends AdapterBaseCl {
|
|
|
617
565
|
const origin = `${this.id}-${meth}`;
|
|
618
566
|
log.trace(origin);
|
|
619
567
|
|
|
620
|
-
if (this.suspended && this.suspendMode === 'error') {
|
|
621
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
622
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
623
|
-
return callback(null, errorObj);
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
627
|
-
if (uriPath === undefined || uriPath === null || uriPath === '') {
|
|
628
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
|
|
629
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
630
|
-
return callback(null, errorObj);
|
|
631
|
-
}
|
|
632
|
-
if (restMethod === undefined || restMethod === null || restMethod === '') {
|
|
633
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
|
|
634
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
635
|
-
return callback(null, errorObj);
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
639
|
-
// remove any leading / and split the uripath into path variables
|
|
640
|
-
let myPath = uriPath;
|
|
641
|
-
while (myPath.indexOf('/') === 0) {
|
|
642
|
-
myPath = myPath.substring(1);
|
|
643
|
-
}
|
|
644
|
-
const pathVars = myPath.split('/');
|
|
645
|
-
const queryParamsAvailable = queryData;
|
|
646
|
-
const queryParams = {};
|
|
647
|
-
const bodyVars = requestBody;
|
|
648
|
-
|
|
649
|
-
// loop in template. long callback arg name to avoid identifier conflicts
|
|
650
|
-
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
651
|
-
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
652
|
-
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
653
|
-
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
654
|
-
}
|
|
655
|
-
});
|
|
656
|
-
|
|
657
|
-
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
|
|
658
|
-
const reqObj = {
|
|
659
|
-
payload: bodyVars,
|
|
660
|
-
uriPathVars: pathVars,
|
|
661
|
-
uriQuery: queryParams,
|
|
662
|
-
uriOptions: {}
|
|
663
|
-
};
|
|
664
|
-
// add headers if provided
|
|
665
|
-
if (addlHeaders) {
|
|
666
|
-
reqObj.addlHeaders = addlHeaders;
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
// determine the call and return flag
|
|
670
|
-
let action = 'getGenerics';
|
|
671
|
-
let returnF = true;
|
|
672
|
-
if (restMethod.toUpperCase() === 'POST') {
|
|
673
|
-
action = 'createGeneric';
|
|
674
|
-
} else if (restMethod.toUpperCase() === 'PUT') {
|
|
675
|
-
action = 'updateGeneric';
|
|
676
|
-
} else if (restMethod.toUpperCase() === 'PATCH') {
|
|
677
|
-
action = 'patchGeneric';
|
|
678
|
-
} else if (restMethod.toUpperCase() === 'DELETE') {
|
|
679
|
-
action = 'deleteGeneric';
|
|
680
|
-
returnF = false;
|
|
681
|
-
}
|
|
682
|
-
|
|
683
568
|
try {
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
// return an error
|
|
689
|
-
if (irReturnError) {
|
|
690
|
-
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
691
|
-
return callback(null, irReturnError);
|
|
692
|
-
}
|
|
693
|
-
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
694
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequest'], null, null, null);
|
|
695
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
696
|
-
return callback(null, errorObj);
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
700
|
-
// return the response
|
|
701
|
-
return callback(irReturnData, null);
|
|
702
|
-
});
|
|
703
|
-
} catch (ex) {
|
|
704
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
705
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
706
|
-
return callback(null, errorObj);
|
|
569
|
+
return super.genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
|
|
570
|
+
} catch (err) {
|
|
571
|
+
log.error(`${origin}: ${err}`);
|
|
572
|
+
return callback(null, err);
|
|
707
573
|
}
|
|
708
574
|
}
|
|
709
575
|
|
|
@@ -727,94 +593,56 @@ class Okta extends AdapterBaseCl {
|
|
|
727
593
|
const origin = `${this.id}-${meth}`;
|
|
728
594
|
log.trace(origin);
|
|
729
595
|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
737
|
-
if (uriPath === undefined || uriPath === null || uriPath === '') {
|
|
738
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
|
|
739
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
740
|
-
return callback(null, errorObj);
|
|
741
|
-
}
|
|
742
|
-
if (restMethod === undefined || restMethod === null || restMethod === '') {
|
|
743
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
|
|
744
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
745
|
-
return callback(null, errorObj);
|
|
596
|
+
try {
|
|
597
|
+
return super.genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
|
|
598
|
+
} catch (err) {
|
|
599
|
+
log.error(`${origin}: ${err}`);
|
|
600
|
+
return callback(null, err);
|
|
746
601
|
}
|
|
602
|
+
}
|
|
747
603
|
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
const
|
|
757
|
-
const
|
|
604
|
+
/* INVENTORY CALLS */
|
|
605
|
+
/**
|
|
606
|
+
* @summary run the adapter lint script to return the results.
|
|
607
|
+
*
|
|
608
|
+
* @function iapRunAdapterLint
|
|
609
|
+
* @param {Callback} callback - callback function
|
|
610
|
+
*/
|
|
611
|
+
iapRunAdapterLint(callback) {
|
|
612
|
+
const meth = 'adapter-iapRunAdapterLint';
|
|
613
|
+
const origin = `${this.id}-${meth}`;
|
|
614
|
+
log.trace(origin);
|
|
758
615
|
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
762
|
-
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
763
|
-
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
764
|
-
}
|
|
765
|
-
});
|
|
616
|
+
return super.iapRunAdapterLint(callback);
|
|
617
|
+
}
|
|
766
618
|
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
619
|
+
/**
|
|
620
|
+
* @summary run the adapter test scripts (baseunit and unit) to return the results.
|
|
621
|
+
* can not run integration as there can be implications with that.
|
|
622
|
+
*
|
|
623
|
+
* @function iapRunAdapterTests
|
|
624
|
+
* @param {Callback} callback - callback function
|
|
625
|
+
*/
|
|
626
|
+
iapRunAdapterTests(callback) {
|
|
627
|
+
const meth = 'adapter-iapRunAdapterTests';
|
|
628
|
+
const origin = `${this.id}-${meth}`;
|
|
629
|
+
log.trace(origin);
|
|
778
630
|
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
let returnF = true;
|
|
782
|
-
if (restMethod.toUpperCase() === 'POST') {
|
|
783
|
-
action = 'createGenericNoBase';
|
|
784
|
-
} else if (restMethod.toUpperCase() === 'PUT') {
|
|
785
|
-
action = 'updateGenericNoBase';
|
|
786
|
-
} else if (restMethod.toUpperCase() === 'PATCH') {
|
|
787
|
-
action = 'patchGenericNoBase';
|
|
788
|
-
} else if (restMethod.toUpperCase() === 'DELETE') {
|
|
789
|
-
action = 'deleteGenericNoBase';
|
|
790
|
-
returnF = false;
|
|
791
|
-
}
|
|
631
|
+
return super.iapRunAdapterTests(callback);
|
|
632
|
+
}
|
|
792
633
|
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
804
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequestNoBasePath'], null, null, null);
|
|
805
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
806
|
-
return callback(null, errorObj);
|
|
807
|
-
}
|
|
634
|
+
/**
|
|
635
|
+
* @summary provide inventory information abbout the adapter
|
|
636
|
+
*
|
|
637
|
+
* @function iapGetAdapterInventory
|
|
638
|
+
* @param {Callback} callback - callback function
|
|
639
|
+
*/
|
|
640
|
+
iapGetAdapterInventory(callback) {
|
|
641
|
+
const meth = 'adapter-iapGetAdapterInventory';
|
|
642
|
+
const origin = `${this.id}-${meth}`;
|
|
643
|
+
log.trace(origin);
|
|
808
644
|
|
|
809
|
-
|
|
810
|
-
// return the response
|
|
811
|
-
return callback(irReturnData, null);
|
|
812
|
-
});
|
|
813
|
-
} catch (ex) {
|
|
814
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
815
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
816
|
-
return callback(null, errorObj);
|
|
817
|
-
}
|
|
645
|
+
return super.iapGetAdapterInventory(callback);
|
|
818
646
|
}
|
|
819
647
|
|
|
820
648
|
/**
|