@itentialopensource/adapter-utils 5.3.10 → 5.4.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 CHANGED
@@ -1,4 +1,14 @@
1
1
 
2
+ ## 5.4.0 [04-26-2024]
3
+
4
+ * changes to support changing scope and resource
5
+
6
+ Closes ADAPT-3342
7
+
8
+ See merge request itentialopensource/adapter-utils!292
9
+
10
+ ---
11
+
2
12
  ## 5.3.10 [03-06-2024]
3
13
 
4
14
  * Fix some security vulnerabilities
@@ -58,6 +58,8 @@ let username = null;
58
58
  let password = null;
59
59
  let clientId = null;
60
60
  let clientSecret = null;
61
+ let scope = null;
62
+ let resource = null;
61
63
  let grantType = null;
62
64
  let staticToken = null;
63
65
  let tokenUserField = 'username';
@@ -2083,6 +2085,12 @@ async function buildTokenRequest(reqPath, reqBody, callProperties, callback) {
2083
2085
  if (clientSecret) {
2084
2086
  creds.client_secret = clientSecret;
2085
2087
  }
2088
+ if (scope) {
2089
+ creds.scope = scope;
2090
+ }
2091
+ if (resource) {
2092
+ creds.resource = resource;
2093
+ }
2086
2094
  if (grantType) {
2087
2095
  creds.grant_type = grantType;
2088
2096
  }
@@ -2092,6 +2100,12 @@ async function buildTokenRequest(reqPath, reqBody, callProperties, callback) {
2092
2100
  if (callProperties && callProperties.authentication && callProperties.authentication.client_secret) {
2093
2101
  creds.client_secret = callProperties.authentication.client_secret;
2094
2102
  }
2103
+ if (callProperties && callProperties.authentication && callProperties.authentication.scope) {
2104
+ creds.scope = callProperties.authentication.scope;
2105
+ }
2106
+ if (callProperties && callProperties.authentication && callProperties.authentication.resource) {
2107
+ creds.resource = callProperties.authentication.resource;
2108
+ }
2095
2109
  if (callProperties && callProperties.authentication && callProperties.authentication.grant_type) {
2096
2110
  creds.grant_type = callProperties.authentication.grant_type;
2097
2111
  }
@@ -3986,6 +4000,16 @@ class ConnectorRest {
3986
4000
  clientSecret = props.authentication.client_secret;
3987
4001
  }
3988
4002
 
4003
+ // set the client secret (optional - default is null)
4004
+ if (typeof props.authentication.scope === 'string') {
4005
+ scope = props.authentication.scope;
4006
+ }
4007
+
4008
+ // set the client secret (optional - default is null)
4009
+ if (typeof props.authentication.resource === 'string') {
4010
+ resource = props.authentication.resource;
4011
+ }
4012
+
3989
4013
  // set the grant type (optional - default is null)
3990
4014
  if (typeof props.authentication.grant_type === 'string') {
3991
4015
  grantType = props.authentication.grant_type;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-utils",
3
- "version": "5.3.10",
3
+ "version": "5.4.0",
4
4
  "description": "Itential Adapter Utility Libraries",
5
5
  "scripts": {
6
6
  "postinstall": "node utils/setup.js",
Binary file