@itentialopensource/adapter-microsoft_graph 1.3.4 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
package/TAB2.md ADDED
@@ -0,0 +1,340 @@
1
+ # Microsoft Graph
2
+
3
+ ## Table of Contents
4
+
5
+ - [Specific Adapter Information](#specific-adapter-information)
6
+ - [Authentication](#authentication)
7
+ - [Sample Properties](#sample-properties)
8
+ - [Swagger](#swagger)
9
+ - [Generic Adapter Information](#generic-adapter-information)
10
+
11
+ ## Specific Adapter Information
12
+ ### Authentication
13
+
14
+ This document will go through the steps for authenticating the Microsoft Graph adapter with OAuth Authentication. Properly configuring the properties for an adapter in IAP is critical for getting the adapter online. You can read more about adapter authentication <a href="https://docs.itential.com/opensource/docs/authentication" target="_blank">HERE</a>.
15
+
16
+ Companies periodically change authentication methods to provide better security. As this happens this section should be updated and contributed/merge back into the adapter repository.
17
+
18
+ #### OAuth Authentication
19
+ The Microsoft Graph adapter requires OAuth Authentication. If you change authentication methods, you should change this section accordingly and merge it back into the adapter repository.
20
+
21
+ STEPS
22
+ 1. Ensure you have access to a Microsoft Graph server and that it is running
23
+ 2. Follow the steps in the README.md to import the adapter into IAP if you have not already done so
24
+ 3. Use the properties below for the ```properties.authentication``` field. Note that the token_URI_path has a variable which should be replaced with a valid tenant value
25
+ ```json
26
+ "authentication": {
27
+ "auth_method": "request_token",
28
+ "token_timeout": 600000,
29
+ "token_cache": "local",
30
+ "token_URI_path": "/{tenant}/oauth2/v2.0/token",
31
+ "invalid_token_error": 401,
32
+ "auth_field": "header.headers.Authorization",
33
+ "auth_field_format": "Bearer {token}",
34
+ "client_id": "<client_id>",
35
+ "client_secret": "<client_secret>",
36
+ "grant_type": "client_credentials",
37
+ "auth_logging": false,
38
+ "sso": {
39
+ "protocol": "https",
40
+ "host": "login.microsoftonline.com",
41
+ "port": 443
42
+ }
43
+ }
44
+ ```
45
+ 4. Use the properties below for the ```properties.request.global_request.authData``` field to add scope to the token request
46
+ ```json
47
+ "request": {
48
+ "global_request": {
49
+ "authData": {
50
+ "scope": "https://graph.microsoft.com/.default"
51
+ }
52
+ }
53
+ }
54
+ ```
55
+ 5. Restart the adapter. If your properties were set correctly, the adapter should go online.
56
+
57
+ #### Troubleshooting
58
+ - Make sure you copied over the correct client_id and client_secret.
59
+ - Turn on debug level logs for the adapter in IAP Admin Essentials.
60
+ - Turn on auth_logging for the adapter in IAP Admin Essentials (adapter properties).
61
+ - Investigate the logs - in particular:
62
+ - The FULL REQUEST log to make sure the proper headers are being sent with the request.
63
+ - The FULL BODY log to make sure the payload is accurate.
64
+ - The CALL RETURN log to see what the other system is telling us.
65
+ - Credentials should be ** masked ** by the adapter so make sure you verify the username and password - including that there are erroneous spaces at the front or end.
66
+ - Remember when you are done to turn auth_logging off as you do not want to log credentials.
67
+
68
+ ### Sample Properties
69
+
70
+ Sample Properties can be used to help you configure the adapter in the Itential Automation Platform. You will need to update connectivity information such as the host, port, protocol and credentials.
71
+
72
+ ```json
73
+ "properties": {
74
+ "host": "localhost",
75
+ "port": 443,
76
+ "base_path": "/",
77
+ "choosepath": "",
78
+ "version": "",
79
+ "cache_location": "none",
80
+ "encode_pathvars": true,
81
+ "encode_queryvars": true,
82
+ "save_metric": false,
83
+ "stub": true,
84
+ "protocol": "https",
85
+ "authentication": {
86
+ "auth_method": "request_token",
87
+ "username": "",
88
+ "password": "",
89
+ "token": "token",
90
+ "token_timeout": 600000,
91
+ "token_cache": "local",
92
+ "token_URI_path": "/{tenant}/oauth2/v2.0/token",
93
+ "invalid_token_error": 401,
94
+ "auth_field": "header.headers.Authorization",
95
+ "auth_field_format": "Bearer {token}",
96
+ "auth_logging": false,
97
+ "client_id": "",
98
+ "client_secret": "",
99
+ "grant_type": "client_credentials",
100
+ "sensitive": [],
101
+ "sso": {
102
+ "protocol": "",
103
+ "host": "",
104
+ "port": 0
105
+ },
106
+ "multiStepAuthCalls": [
107
+ {
108
+ "name": "",
109
+ "requestFields": {},
110
+ "responseFields": {},
111
+ "successfullResponseCode": 200
112
+ }
113
+ ]
114
+ },
115
+ "healthcheck": {
116
+ "type": "none",
117
+ "frequency": 60000,
118
+ "query_object": {},
119
+ "addlHeaders": {}
120
+ },
121
+ "throttle": {
122
+ "throttle_enabled": false,
123
+ "number_pronghorns": 1,
124
+ "sync_async": "sync",
125
+ "max_in_queue": 1000,
126
+ "concurrent_max": 1,
127
+ "expire_timeout": 0,
128
+ "avg_runtime": 200,
129
+ "priorities": [
130
+ {
131
+ "value": 0,
132
+ "percent": 100
133
+ }
134
+ ]
135
+ },
136
+ "request": {
137
+ "number_redirects": 0,
138
+ "number_retries": 3,
139
+ "limit_retry_error": [
140
+ 0
141
+ ],
142
+ "failover_codes": [],
143
+ "attempt_timeout": 5000,
144
+ "global_request": {
145
+ "payload": {},
146
+ "uriOptions": {},
147
+ "addlHeaders": {},
148
+ "authData": {
149
+ "scope": "https://graph.microsoft.com/.default"
150
+ }
151
+ },
152
+ "healthcheck_on_timeout": true,
153
+ "return_raw": false,
154
+ "archiving": false,
155
+ "return_request": false
156
+ },
157
+ "proxy": {
158
+ "enabled": false,
159
+ "host": "",
160
+ "port": 1,
161
+ "protocol": "http",
162
+ "username": "",
163
+ "password": ""
164
+ },
165
+ "ssl": {
166
+ "ecdhCurve": "",
167
+ "enabled": false,
168
+ "accept_invalid_cert": false,
169
+ "ca_file": "",
170
+ "key_file": "",
171
+ "cert_file": "",
172
+ "secure_protocol": "",
173
+ "ciphers": ""
174
+ },
175
+ "mongo": {
176
+ "host": "",
177
+ "port": 0,
178
+ "database": "",
179
+ "username": "",
180
+ "password": "",
181
+ "replSet": "",
182
+ "db_ssl": {
183
+ "enabled": false,
184
+ "accept_invalid_cert": false,
185
+ "ca_file": "",
186
+ "key_file": "",
187
+ "cert_file": ""
188
+ }
189
+ },
190
+ "devicebroker": {
191
+ "enabled": false,
192
+ "getDevice": [
193
+ {
194
+ "path": "/not/mapped",
195
+ "method": "GET",
196
+ "query": {},
197
+ "body": {},
198
+ "headers": {},
199
+ "handleFailure": "ignore",
200
+ "requestFields": {
201
+ "insample": "{port}"
202
+ },
203
+ "responseDatakey": "",
204
+ "responseFields": {
205
+ "name": "{this}{||}{that}",
206
+ "ostype": "{osfield}",
207
+ "ostypePrefix": "meraki-",
208
+ "port": "{port}",
209
+ "ipaddress": "{ip_addr}",
210
+ "serial": "{serial}"
211
+ }
212
+ }
213
+ ],
214
+ "getDevicesFiltered": [
215
+ {
216
+ "path": "/not/mapped",
217
+ "method": "GET",
218
+ "pagination": {
219
+ "offsetVar": "",
220
+ "limitVar": "",
221
+ "incrementBy": "limit",
222
+ "requestLocation": "query"
223
+ },
224
+ "query": {},
225
+ "body": {},
226
+ "headers": {},
227
+ "handleFailure": "ignore",
228
+ "requestFields": {},
229
+ "responseDatakey": "",
230
+ "responseFields": {
231
+ "name": "{this}{||}{that}",
232
+ "ostype": "{osfield}",
233
+ "ostypePrefix": "meraki-",
234
+ "port": "{port}",
235
+ "ipaddress": "{ip_addr}",
236
+ "serial": "{serial}",
237
+ "id": "{myid}"
238
+ }
239
+ }
240
+ ],
241
+ "isAlive": [
242
+ {
243
+ "path": "/not/mapped/{devID}",
244
+ "method": "GET",
245
+ "query": {},
246
+ "body": {},
247
+ "headers": {},
248
+ "handleFailure": "ignore",
249
+ "requestFields": {
250
+ "devID": "{id}"
251
+ },
252
+ "responseDatakey": "",
253
+ "responseFields": {
254
+ "status": "return2xx",
255
+ "statusValue": "AD.200"
256
+ }
257
+ }
258
+ ],
259
+ "getConfig": [
260
+ {
261
+ "path": "/not/mapped/{devID}",
262
+ "method": "GET",
263
+ "query": {},
264
+ "body": {},
265
+ "headers": {},
266
+ "handleFailure": "ignore",
267
+ "requestFields": {
268
+ "devID": "{id}"
269
+ },
270
+ "responseDatakey": "",
271
+ "responseFields": {}
272
+ }
273
+ ],
274
+ "getCount": [
275
+ {
276
+ "path": "/not/mapped",
277
+ "method": "GET",
278
+ "query": {},
279
+ "body": {},
280
+ "headers": {},
281
+ "handleFailure": "ignore",
282
+ "requestFields": {},
283
+ "responseDatakey": "",
284
+ "responseFields": {}
285
+ }
286
+ ]
287
+ },
288
+ "cache": {
289
+ "enabled": false,
290
+ "entities": [
291
+ {
292
+ "entityType": "device",
293
+ "frequency": 3600,
294
+ "flushOnFail": false,
295
+ "limit": 10000,
296
+ "retryAttempts": 5,
297
+ "sort": true,
298
+ "populate": [
299
+ {
300
+ "path": "/not/mapped",
301
+ "method": "GET",
302
+ "pagination": {
303
+ "offsetVar": "",
304
+ "limitVar": "",
305
+ "incrementBy": "limit",
306
+ "requestLocation": "query"
307
+ },
308
+ "query": {},
309
+ "body": {},
310
+ "headers": {},
311
+ "handleFailure": "ignore",
312
+ "requestFields": {},
313
+ "responseDatakey": "",
314
+ "responseFields": {
315
+ "name": "{this}{||}{that}",
316
+ "ostype": "{osfield}",
317
+ "ostypePrefix": "meraki-",
318
+ "port": "{port}",
319
+ "ipaddress": "{ip_addr}",
320
+ "serial": "{serial}",
321
+ "id": "{myid}"
322
+ }
323
+ }
324
+ ],
325
+ "cachedTasks": [
326
+ {
327
+ "name": "",
328
+ "filterField": "",
329
+ "filterLoc": ""
330
+ }
331
+ ]
332
+ }
333
+ ]
334
+ }
335
+ }
336
+ ```
337
+ ### [Swagger](https://gitlab.com/itentialopensource/adapters/cloud/adapter-microsoft_graph/-/blob/master/report/adapter-openapi.json)
338
+
339
+ ## [Generic Adapter Information](https://gitlab.com/itentialopensource/adapters/cloud/adapter-microsoft_graph/-/blob/master/README.md)
340
+
@@ -0,0 +1,9 @@
1
+ {
2
+ "ComplianceEntries": [
3
+ {
4
+ "name": "Compliance Summary",
5
+ "numInvalidProjects": 0,
6
+ "numValidProjects": 0
7
+ }
8
+ ]
9
+ }
@@ -0,0 +1,5 @@
1
+ ---------------------------------------------------------------------------------------------
2
+ **** Project Compliance Summary ****
3
+ 0 project(s) are not valid
4
+ 0 project(s) are valid
5
+ ---------------------------------------------------------------------------------------------
package/metadata.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "adapter-microsoft_graph",
3
3
  "webName": "Adapter for Integration to Microsoft Graph",
4
4
  "vendor": "Microsoft",
5
- "product": "Graph",
5
+ "product": "Microsoft Graph",
6
6
  "osVersion": [],
7
7
  "apiVersions": [
8
8
  "1.0"
@@ -44,13 +44,24 @@
44
44
  "isDeprecated": false
45
45
  },
46
46
  "brokerSince": "",
47
+ "authMethods": [
48
+ {
49
+ "type": "OAuth",
50
+ "primary": true
51
+ }
52
+ ],
47
53
  "documentation": {
48
54
  "storeLink": "",
49
55
  "npmLink": "https://www.npmjs.com/package/@itentialopensource/adapter-microsoft_graph",
50
- "repoLink": "https://gitlab.com/itentialopensource/adapters/cloud/adapter-microsoft_graph",
56
+ "repoLink": "https://gitlab.com/itentialopensource/adapters/adapter-microsoft_graph",
51
57
  "docLink": "https://docs.itential.com/opensource/docs/microsoft-graph",
52
58
  "demoLinks": [],
53
- "trainingLinks": [],
59
+ "trainingLinks": [
60
+ {
61
+ "title": "Itential Academy",
62
+ "link": "https://www.itential.com/itential-academy/"
63
+ }
64
+ ],
54
65
  "faqLink": "https://docs.itential.com/opensource/docs/troubleshooting-an-adapter",
55
66
  "contributeLink": "https://gitlab.com/itentialopensource/adapters/contributing-guide",
56
67
  "issueLink": "https://itential.atlassian.net/servicedesk/customer/portals",
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-microsoft_graph",
3
- "version": "1.3.4",
3
+ "version": "1.4.0",
4
4
  "description": "This adapter integrates with system described as: microsoftGraph.",
5
5
  "main": "adapter.js",
6
6
  "wizardVersion": "2.44.7",
7
- "engineVersion": "1.67.10",
7
+ "engineVersion": "1.67.20",
8
8
  "adapterType": "http",
9
9
  "scripts": {
10
10
  "artifactize": "npm i && node utils/packModificationScript.js",
@@ -15,7 +15,6 @@
15
15
  "test:baseunit": "mocha test/unit/adapterBaseTestUnit.js --LOG=error",
16
16
  "test:unit": "mocha test/unit/adapterTestUnit.js --LOG=error",
17
17
  "test:integration": "mocha test/integration/adapterTestIntegration.js --LOG=error",
18
- "test:cover": "nyc --reporter html --reporter text mocha --reporter dot test/*",
19
18
  "test": "npm run test:baseunit && npm run test:unit && npm run test:integration",
20
19
  "adapter:install": "npm i && node utils/tbScript.js install",
21
20
  "adapter:checkMigrate": "node utils/checkMigrate.js",
@@ -44,20 +43,20 @@
44
43
  ],
45
44
  "license": "Apache-2.0",
46
45
  "engines": {
47
- "node": ">= 8.0.0",
46
+ "node": ">= 14.0.0",
48
47
  "npm": ">= 6.0.0"
49
48
  },
50
49
  "repository": {
51
50
  "type": "git",
52
- "url": "git@gitlab.com:itentialopensource/adapters/cloud/adapter-microsoft_graph.git"
51
+ "url": "git@gitlab.com:itentialopensource/adapters/adapter-microsoft_graph.git"
53
52
  },
54
53
  "author": "Itential",
55
- "homepage": "https://gitlab.com/itentialopensource/adapters/cloud/adapter-microsoft_graph#readme",
54
+ "homepage": "https://gitlab.com/itentialopensource/adapters/adapter-microsoft_graph#readme",
56
55
  "dependencies": {
57
- "@itentialopensource/adapter-utils": "^5.3.8",
56
+ "@itentialopensource/adapter-utils": "^5.5.0",
58
57
  "acorn": "^8.10.0",
59
58
  "ajv": "^8.12.0",
60
- "axios": "^1.6.7",
59
+ "axios": "^1.6.8",
61
60
  "commander": "^11.0.0",
62
61
  "dns-lookup-promise": "^1.0.4",
63
62
  "fs-extra": "^11.1.1",
@@ -65,7 +64,6 @@
65
64
  "mocha": "^10.3.0",
66
65
  "mocha-param": "^2.0.1",
67
66
  "mongodb": "^4.16.0",
68
- "nyc": "^15.1.0",
69
67
  "ping": "^0.4.4",
70
68
  "prompts": "^2.4.2",
71
69
  "readline-sync": "^1.4.10",
@@ -945,6 +945,11 @@
945
945
  "devicebroker": {
946
946
  "type": "object",
947
947
  "properties": {
948
+ "enabled": {
949
+ "type": "boolean",
950
+ "description": "Whether or not the device broker calls have been mapped",
951
+ "default": false
952
+ },
948
953
  "getDevice": {
949
954
  "type": "array",
950
955
  "description": "Broker call(s) to getDevice",
Binary file
@@ -1,10 +1,10 @@
1
1
  {
2
- "version": "1.3.0",
3
- "configLines": 10911,
2
+ "version": "1.3.5",
3
+ "configLines": 10916,
4
4
  "scriptLines": 1783,
5
5
  "codeLines": 20170,
6
- "testLines": 15130,
6
+ "testLines": 15129,
7
7
  "testCases": 772,
8
- "totalCodeLines": 37083,
8
+ "totalCodeLines": 37082,
9
9
  "wfTasks": 228
10
10
  }
@@ -0,0 +1,120 @@
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": 31
18
+ },
19
+ {
20
+ "owner": "packageJson",
21
+ "description": "Number of production dependencies",
22
+ "value": 16
23
+ },
24
+ {
25
+ "owner": "packageJson",
26
+ "description": "Number of development dependencies",
27
+ "value": 6
28
+ },
29
+ {
30
+ "owner": "packageJson",
31
+ "description": "Number of npm scripts",
32
+ "value": 21
33
+ },
34
+ {
35
+ "owner": "packageJson",
36
+ "description": "Runtime Library dependency",
37
+ "value": "^5.5.0"
38
+ },
39
+ {
40
+ "owner": "propertiesSchemaJson",
41
+ "description": "Adapter properties defined in the propertiesSchema file",
42
+ "value": 78
43
+ },
44
+ {
45
+ "owner": "markdown",
46
+ "description": "Number of lines in the README.md",
47
+ "value": 344
48
+ },
49
+ {
50
+ "owner": "markdown",
51
+ "description": "Number of lines in the SUMMARY.md",
52
+ "value": 9
53
+ },
54
+ {
55
+ "owner": "markdown",
56
+ "description": "Number of lines in the PROPERTIES.md",
57
+ "value": 647
58
+ },
59
+ {
60
+ "owner": "markdown",
61
+ "description": "Number of lines in the TROUBLESHOOT.md",
62
+ "value": 48
63
+ },
64
+ {
65
+ "owner": "markdown",
66
+ "description": "Number of lines in the ENHANCE.md",
67
+ "value": 70
68
+ },
69
+ {
70
+ "owner": "markdown",
71
+ "description": "Number of lines in the BROKER.md",
72
+ "value": 70
73
+ },
74
+ {
75
+ "owner": "unitTestJS",
76
+ "description": "Number of lines of code in unit tests",
77
+ "value": 7688
78
+ },
79
+ {
80
+ "owner": "unitTestJS",
81
+ "description": "Number of unit tests",
82
+ "value": 491
83
+ },
84
+ {
85
+ "owner": "integrationTestJS",
86
+ "description": "Number of lines of code in integration tests",
87
+ "value": 6189
88
+ },
89
+ {
90
+ "owner": "integrationTestJS",
91
+ "description": "Number of integration tests",
92
+ "value": 211
93
+ },
94
+ {
95
+ "owner": "staticFile",
96
+ "description": "Number of lines of code in adapterBase.js",
97
+ "value": 1453
98
+ },
99
+ {
100
+ "owner": "staticFile",
101
+ "description": "Number of static files added",
102
+ "value": 36
103
+ },
104
+ {
105
+ "owner": "Overall",
106
+ "description": "Total lines of Code",
107
+ "value": 15330
108
+ },
109
+ {
110
+ "owner": "Overall",
111
+ "description": "Total Tests",
112
+ "value": 702
113
+ },
114
+ {
115
+ "owner": "Overall",
116
+ "description": "Total Files",
117
+ "value": 6
118
+ }
119
+ ]
120
+ }