@itentialopensource/adapter-zscaler 0.6.3 → 0.6.7
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/CHANGELOG.md +32 -0
- package/README.md +84 -11
- package/adapter.js +661 -123
- package/adapterBase.js +23 -1
- package/entities/.generic/action.json +5 -5
- package/entities/.system/action.json +5 -5
- package/entities/.system/schemaTokenReq.json +3 -4
- package/entities/.system/schemaTokenResp.json +2 -13
- package/error.json +6 -0
- package/package.json +18 -13
- package/pronghorn.json +312 -120
- package/propertiesSchema.json +20 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/updateReport1642619799800.json +95 -0
- package/sampleProperties.json +5 -1
- package/test/integration/adapterTestBasicGet.js +1 -1
- package/test/integration/adapterTestIntegration.js +10 -2
- package/test/unit/adapterBaseTestUnit.js +6 -3
- package/test/unit/adapterTestUnit.js +489 -4
- package/utils/addAuth.js +94 -0
- package/utils/basicGet.js +1 -14
- package/utils/entitiesToDB.js +224 -0
- package/utils/modify.js +1 -1
- package/utils/packModificationScript.js +1 -1
- package/utils/patches2bundledDeps.js +90 -0
- package/utils/removeHooks.js +20 -0
- package/utils/tbScript.js +14 -8
- package/utils/tbUtils.js +98 -19
- package/utils/troubleshootingAdapter.js +2 -26
package/propertiesSchema.json
CHANGED
|
@@ -135,6 +135,11 @@
|
|
|
135
135
|
"{crypt}password"
|
|
136
136
|
]
|
|
137
137
|
},
|
|
138
|
+
"apiKey": {
|
|
139
|
+
"type": "string",
|
|
140
|
+
"description": "The apiKey used for requests.",
|
|
141
|
+
"default": ""
|
|
142
|
+
},
|
|
138
143
|
"token": {
|
|
139
144
|
"type": "string",
|
|
140
145
|
"description": "The token used for requests",
|
|
@@ -232,6 +237,21 @@
|
|
|
232
237
|
"type": "boolean",
|
|
233
238
|
"description": "This property turns on logging of Authentication Information and should only be true when debugging authentication and connectivity",
|
|
234
239
|
"default": false
|
|
240
|
+
},
|
|
241
|
+
"client_id": {
|
|
242
|
+
"type": "string",
|
|
243
|
+
"description": "The client id for OAuth requests - can also use username depending on schema",
|
|
244
|
+
"default": ""
|
|
245
|
+
},
|
|
246
|
+
"client_secret": {
|
|
247
|
+
"type": "string",
|
|
248
|
+
"description": "The client secret for OAuth requests - can also use password depending on schema",
|
|
249
|
+
"default": ""
|
|
250
|
+
},
|
|
251
|
+
"grant_type": {
|
|
252
|
+
"type": "string",
|
|
253
|
+
"description": "The grant type for OAuth requests - can also provide in schema",
|
|
254
|
+
"default": ""
|
|
235
255
|
}
|
|
236
256
|
},
|
|
237
257
|
"required": [
|
|
Binary file
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"errors": [],
|
|
3
|
+
"statistics": [
|
|
4
|
+
{
|
|
5
|
+
"owner": "errorJson",
|
|
6
|
+
"description": "New adapter errors available for use",
|
|
7
|
+
"value": 0
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"owner": "errorJson",
|
|
11
|
+
"description": "Adapter errors no longer available for use",
|
|
12
|
+
"value": 0
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"owner": "errorJson",
|
|
16
|
+
"description": "Adapter errors that have been updated (e.g. recommendation changes)",
|
|
17
|
+
"value": 30
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"owner": "packageJson",
|
|
21
|
+
"description": "Number of production dependencies",
|
|
22
|
+
"value": 13
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"owner": "packageJson",
|
|
26
|
+
"description": "Number of development dependencies",
|
|
27
|
+
"value": 7
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"owner": "packageJson",
|
|
31
|
+
"description": "Number of npm scripts",
|
|
32
|
+
"value": 23
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"owner": "packageJson",
|
|
36
|
+
"description": "Runtime Library dependency",
|
|
37
|
+
"value": "^4.44.11"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"owner": "propertiesSchemaJson",
|
|
41
|
+
"description": "Adapter properties defined in the propertiesSchema file",
|
|
42
|
+
"value": 65
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"owner": "readmeMd",
|
|
46
|
+
"description": "Number of lines in the README.md",
|
|
47
|
+
"value": 688
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"owner": "unitTestJS",
|
|
51
|
+
"description": "Number of lines of code in unit tests",
|
|
52
|
+
"value": 2357
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"owner": "unitTestJS",
|
|
56
|
+
"description": "Number of unit tests",
|
|
57
|
+
"value": 130
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"owner": "integrationTestJS",
|
|
61
|
+
"description": "Number of lines of code in integration tests",
|
|
62
|
+
"value": 2130
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"owner": "integrationTestJS",
|
|
66
|
+
"description": "Number of integration tests",
|
|
67
|
+
"value": 62
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"owner": "staticFile",
|
|
71
|
+
"description": "Number of lines of code in adapterBase.js",
|
|
72
|
+
"value": 1029
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"owner": "staticFile",
|
|
76
|
+
"description": "Number of static files added",
|
|
77
|
+
"value": 34
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"owner": "Overall",
|
|
81
|
+
"description": "Total lines of Code",
|
|
82
|
+
"value": 5516
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"owner": "Overall",
|
|
86
|
+
"description": "Total Tests",
|
|
87
|
+
"value": 192
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"owner": "Overall",
|
|
91
|
+
"description": "Total Files",
|
|
92
|
+
"value": 6
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
package/sampleProperties.json
CHANGED
|
@@ -15,13 +15,17 @@
|
|
|
15
15
|
"auth_method": "basic user_password",
|
|
16
16
|
"username": "exampleUsername",
|
|
17
17
|
"password": "examplePassword",
|
|
18
|
+
"apiKey": "exampleApiKey",
|
|
18
19
|
"token": "",
|
|
19
20
|
"token_timeout": 180000,
|
|
20
21
|
"token_cache": "local",
|
|
21
22
|
"invalid_token_error": 401,
|
|
22
23
|
"auth_field": "header.headers.Authorization",
|
|
23
24
|
"auth_field_format": "Basic {b64}{username}:{password}{/b64}",
|
|
24
|
-
"auth_logging": false
|
|
25
|
+
"auth_logging": false,
|
|
26
|
+
"client_id": "",
|
|
27
|
+
"client_secret": "",
|
|
28
|
+
"grant_type": ""
|
|
25
29
|
},
|
|
26
30
|
"healthcheck": {
|
|
27
31
|
"type": "none",
|
|
@@ -14,7 +14,7 @@ const itParam = require('mocha-param');
|
|
|
14
14
|
|
|
15
15
|
const utils = require('../../utils/tbUtils');
|
|
16
16
|
const basicGet = require('../../utils/basicGet');
|
|
17
|
-
const { name } = require('../../package');
|
|
17
|
+
const { name } = require('../../package.json');
|
|
18
18
|
const { methods } = require('../../pronghorn.json');
|
|
19
19
|
|
|
20
20
|
const getPronghornProps = (iapDir) => {
|
|
@@ -13,7 +13,10 @@ const winston = require('winston');
|
|
|
13
13
|
const { expect } = require('chai');
|
|
14
14
|
const { use } = require('chai');
|
|
15
15
|
const td = require('testdouble');
|
|
16
|
+
const util = require('util');
|
|
17
|
+
const pronghorn = require('../../pronghorn.json');
|
|
16
18
|
|
|
19
|
+
pronghorn.methodsByName = pronghorn.methods.reduce((result, meth) => ({ ...result, [meth.name]: meth }), {});
|
|
17
20
|
const anything = td.matchers.anything();
|
|
18
21
|
|
|
19
22
|
// stub and attemptTimeout are used throughout the code so set them here
|
|
@@ -63,7 +66,10 @@ global.pronghornProps = {
|
|
|
63
66
|
invalid_token_error: 401,
|
|
64
67
|
auth_field: 'header.headers.Authorization',
|
|
65
68
|
auth_field_format: 'Basic {b64}{username}:{password}{/b64}',
|
|
66
|
-
auth_logging: false
|
|
69
|
+
auth_logging: false,
|
|
70
|
+
client_id: '',
|
|
71
|
+
client_secret: '',
|
|
72
|
+
grant_type: ''
|
|
67
73
|
},
|
|
68
74
|
healthcheck: {
|
|
69
75
|
type: 'startup',
|
|
@@ -310,7 +316,7 @@ function saveMockData(entityName, actionName, descriptor, responseData) {
|
|
|
310
316
|
}
|
|
311
317
|
|
|
312
318
|
// require the adapter that we are going to be using
|
|
313
|
-
const Zscaler = require('../../adapter
|
|
319
|
+
const Zscaler = require('../../adapter');
|
|
314
320
|
|
|
315
321
|
// begin the testing - these should be pretty well defined between the describe and the it!
|
|
316
322
|
describe('[integration] Zscaler Adapter Test', () => {
|
|
@@ -341,6 +347,8 @@ describe('[integration] Zscaler Adapter Test', () => {
|
|
|
341
347
|
try {
|
|
342
348
|
assert.notEqual(null, a);
|
|
343
349
|
assert.notEqual(undefined, a);
|
|
350
|
+
const checkId = global.pronghornProps.adapterProps.adapters[0].id;
|
|
351
|
+
assert.equal(checkId, a.id);
|
|
344
352
|
assert.notEqual(null, a.allProps);
|
|
345
353
|
const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
|
|
346
354
|
assert.equal(check, a.healthcheckType);
|
|
@@ -61,7 +61,10 @@ global.pronghornProps = {
|
|
|
61
61
|
token_cache: 'local',
|
|
62
62
|
auth_field: 'header.headers.Authorization',
|
|
63
63
|
auth_field_format: 'Basic {b64}{username}:{password}{/b64}',
|
|
64
|
-
auth_logging: false
|
|
64
|
+
auth_logging: false,
|
|
65
|
+
client_id: '',
|
|
66
|
+
client_secret: '',
|
|
67
|
+
grant_type: ''
|
|
65
68
|
},
|
|
66
69
|
healthcheck: {
|
|
67
70
|
type: 'none',
|
|
@@ -194,7 +197,7 @@ function runErrorAsserts(data, error, code, origin, displayStr) {
|
|
|
194
197
|
}
|
|
195
198
|
|
|
196
199
|
// require the adapter that we are going to be using
|
|
197
|
-
const AdapterBase = require('../../adapterBase
|
|
200
|
+
const AdapterBase = require('../../adapterBase');
|
|
198
201
|
|
|
199
202
|
// delete the .DS_Store directory in entities -- otherwise this will cause errors
|
|
200
203
|
const dirPath = path.join(__dirname, '../../entities/.DS_Store');
|
|
@@ -314,7 +317,7 @@ describe('[unit] Adapter Base Test', () => {
|
|
|
314
317
|
});
|
|
315
318
|
it('should return a list of functions', (done) => {
|
|
316
319
|
const returnedFunctions = ['addEntityCache', 'capabilityResults', 'checkActionFiles', 'checkProperties', 'connect', 'encryptProperty',
|
|
317
|
-
'entityInList', 'findPath', 'getAllCapabilities', 'getAllFunctions', 'getQueue', 'getWorkflowFunctions', 'healthCheck',
|
|
320
|
+
'entityInList', 'findPath', 'getAllCapabilities', 'getAllFunctions', 'getQueue', 'getWorkflowFunctions', 'healthCheck', 'moveEntitiesToDB',
|
|
318
321
|
'refreshProperties', 'runBasicGet', 'runConnectivity', 'runHealthcheck', 'suspend', 'troubleshoot', 'unsuspend', 'updateAdapterConfiguration', 'addListener',
|
|
319
322
|
'emit', 'eventNames', 'getMaxListeners', 'listenerCount', 'listeners', 'off', 'on', 'once', 'prependListener',
|
|
320
323
|
'prependOnceListener', 'rawListeners', 'removeAllListeners', 'removeListener', 'setMaxListeners'];
|