@itentialopensource/adapter-utils 4.46.0 → 4.47.0
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 +10 -0
- package/lib/connectorRest.js +34 -6
- package/package.json +1 -1
- package/schemas/propertiesSchema.json +28 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
|
|
2
|
+
## 4.47.0 [08-13-2022]
|
|
3
|
+
|
|
4
|
+
* Add SSO capability into service instance config
|
|
5
|
+
|
|
6
|
+
Closes ADAPT-2328
|
|
7
|
+
|
|
8
|
+
See merge request itentialopensource/adapter-utils!235
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
2
12
|
## 4.46.0 [07-27-2022]
|
|
3
13
|
|
|
4
14
|
* Added code to skip split string on dot for special cases
|
package/lib/connectorRest.js
CHANGED
|
@@ -62,6 +62,7 @@ let tokenTimeout = -1;
|
|
|
62
62
|
let tokenError = 401;
|
|
63
63
|
let tokenPath = null;
|
|
64
64
|
let tokenCache = 'local';
|
|
65
|
+
let sso = null;
|
|
65
66
|
const tokenList = [];
|
|
66
67
|
const tokenlock = 0;
|
|
67
68
|
let stub = false;
|
|
@@ -1646,6 +1647,28 @@ function buildTokenRequest(reqPath, reqBody, callProperties, callback) {
|
|
|
1646
1647
|
}
|
|
1647
1648
|
|
|
1648
1649
|
// specific token properties override everything (Single Sign On System)
|
|
1650
|
+
if (sso && sso.host) {
|
|
1651
|
+
options.hostname = sso.host;
|
|
1652
|
+
}
|
|
1653
|
+
if (sso && sso.port) {
|
|
1654
|
+
options.port = sso.port;
|
|
1655
|
+
}
|
|
1656
|
+
if (sso && sso.protocol) {
|
|
1657
|
+
// need to put protocol in token schema
|
|
1658
|
+
if (!tokenSchema) {
|
|
1659
|
+
tokenSchema = {
|
|
1660
|
+
sso: {
|
|
1661
|
+
protocol: sso.protocol
|
|
1662
|
+
}
|
|
1663
|
+
};
|
|
1664
|
+
} else if (tokenSchema && !tokenSchema.sso) {
|
|
1665
|
+
tokenSchema.sso = {
|
|
1666
|
+
protocol: sso.protocol
|
|
1667
|
+
};
|
|
1668
|
+
} else if (tokenSchema && tokenSchema.sso && !tokenSchema.sso.protocol) {
|
|
1669
|
+
tokenSchema.sso.protocol = sso.protocol;
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1649
1672
|
if (tokenSchema && tokenSchema.sso && tokenSchema.sso.host) {
|
|
1650
1673
|
options.hostname = tokenSchema.sso.host;
|
|
1651
1674
|
}
|
|
@@ -3347,19 +3370,19 @@ class ConnectorRest {
|
|
|
3347
3370
|
tokenTimeout = Number(props.authentication.token_timeout);
|
|
3348
3371
|
}
|
|
3349
3372
|
|
|
3350
|
-
// set the token cache (
|
|
3373
|
+
// set the token cache (optional - default is local)
|
|
3351
3374
|
if (typeof props.authentication.token_cache === 'string') {
|
|
3352
3375
|
tokenCache = props.authentication.token_cache;
|
|
3353
3376
|
}
|
|
3354
3377
|
|
|
3355
|
-
// set the auth field (
|
|
3378
|
+
// set the auth field (optional - default is null)
|
|
3356
3379
|
if (typeof props.authentication.auth_field === 'string') {
|
|
3357
3380
|
authField = [props.authentication.auth_field];
|
|
3358
3381
|
} else if (Array.isArray(props.authentication.auth_field)) {
|
|
3359
3382
|
authField = props.authentication.auth_field;
|
|
3360
3383
|
}
|
|
3361
3384
|
|
|
3362
|
-
// set the auth format (
|
|
3385
|
+
// set the auth format (optional - default is null)
|
|
3363
3386
|
if (typeof props.authentication.auth_field_format === 'string') {
|
|
3364
3387
|
authFormat = [props.authentication.auth_field_format];
|
|
3365
3388
|
} else if (Array.isArray(props.authentication.auth_field_format)) {
|
|
@@ -3371,20 +3394,25 @@ class ConnectorRest {
|
|
|
3371
3394
|
authLogging = props.authentication.auth_logging;
|
|
3372
3395
|
}
|
|
3373
3396
|
|
|
3374
|
-
// set the client id (
|
|
3397
|
+
// set the client id (optional - default is null)
|
|
3375
3398
|
if (typeof props.authentication.client_id === 'string') {
|
|
3376
3399
|
clientId = props.authentication.client_id;
|
|
3377
3400
|
}
|
|
3378
3401
|
|
|
3379
|
-
// set the client secret (
|
|
3402
|
+
// set the client secret (optional - default is null)
|
|
3380
3403
|
if (typeof props.authentication.client_secret === 'string') {
|
|
3381
3404
|
clientSecret = props.authentication.client_secret;
|
|
3382
3405
|
}
|
|
3383
3406
|
|
|
3384
|
-
// set the grant type (
|
|
3407
|
+
// set the grant type (optional - default is null)
|
|
3385
3408
|
if (typeof props.authentication.grant_type === 'string') {
|
|
3386
3409
|
grantType = props.authentication.grant_type;
|
|
3387
3410
|
}
|
|
3411
|
+
|
|
3412
|
+
// set the sso (optional - default is null)
|
|
3413
|
+
if (props.authentication.sso && typeof props.authentication.sso === 'object') {
|
|
3414
|
+
sso = props.authentication.sso;
|
|
3415
|
+
}
|
|
3388
3416
|
}
|
|
3389
3417
|
|
|
3390
3418
|
// set the stub mode (optional - default is false)
|
package/package.json
CHANGED
|
@@ -252,6 +252,34 @@
|
|
|
252
252
|
"type": "string",
|
|
253
253
|
"description": "The grant type for OAuth requests - can also provide in schema",
|
|
254
254
|
"default": ""
|
|
255
|
+
},
|
|
256
|
+
"sso": {
|
|
257
|
+
"type": "object",
|
|
258
|
+
"properties": {
|
|
259
|
+
"protocol": {
|
|
260
|
+
"type": "string",
|
|
261
|
+
"description": "the protocol to request token from system",
|
|
262
|
+
"default": "",
|
|
263
|
+
"enum": [
|
|
264
|
+
"http", "https", ""
|
|
265
|
+
]
|
|
266
|
+
},
|
|
267
|
+
"host": {
|
|
268
|
+
"type": "string",
|
|
269
|
+
"description": "hostname of the authentication system",
|
|
270
|
+
"default": "",
|
|
271
|
+
"examples": [
|
|
272
|
+
"systemx.customer.com"
|
|
273
|
+
]
|
|
274
|
+
},
|
|
275
|
+
"port": {
|
|
276
|
+
"type": "integer",
|
|
277
|
+
"description": "port on which to connect to the authentication system",
|
|
278
|
+
"default": 0,
|
|
279
|
+
"minimum": 0,
|
|
280
|
+
"maximum": 65535
|
|
281
|
+
}
|
|
282
|
+
}
|
|
255
283
|
}
|
|
256
284
|
},
|
|
257
285
|
"required": [
|