@itentialopensource/adapter-utils 4.45.4 → 4.45.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 +30 -0
- package/lib/connectorRest.js +27 -6
- package/package.json +1 -1
- package/schemas/propertiesSchema.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,34 @@
|
|
|
1
1
|
|
|
2
|
+
## 4.45.7 [07-25-2022]
|
|
3
|
+
|
|
4
|
+
* Fix issue on no token where it takes exception
|
|
5
|
+
|
|
6
|
+
Closes ADAPT-2244
|
|
7
|
+
|
|
8
|
+
See merge request itentialopensource/adapter-utils!233
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 4.45.6 [05-19-2022]
|
|
13
|
+
|
|
14
|
+
* Change for token request with Auth header and data
|
|
15
|
+
|
|
16
|
+
Closes ADAPT-2056
|
|
17
|
+
|
|
18
|
+
See merge request itentialopensource/adapter-utils!232
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 4.45.5 [05-14-2022]
|
|
23
|
+
|
|
24
|
+
* handle missing token data in mockdata
|
|
25
|
+
|
|
26
|
+
Closes ADAPT-2048
|
|
27
|
+
|
|
28
|
+
See merge request itentialopensource/adapter-utils!231
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
2
32
|
## 4.45.4 [05-01-2022]
|
|
3
33
|
|
|
4
34
|
* fix xml mockdata
|
package/lib/connectorRest.js
CHANGED
|
@@ -1135,6 +1135,14 @@ function getToken(reqPath, options, tokenSchema, bodyString, callProperties, cal
|
|
|
1135
1135
|
translated = tokenResp.response;
|
|
1136
1136
|
}
|
|
1137
1137
|
|
|
1138
|
+
// since this is a stub, make sure we have what we need
|
|
1139
|
+
if (!translated.token) {
|
|
1140
|
+
translated.token = 'garbagetoken';
|
|
1141
|
+
}
|
|
1142
|
+
if (!translated.tokenp2) {
|
|
1143
|
+
translated.tokenp2 = 'garbagetoken';
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1138
1146
|
// if what we got back is an array, just return the first element
|
|
1139
1147
|
// should only have one token!!!
|
|
1140
1148
|
if (translated && Array.isArray(translated)) {
|
|
@@ -1153,7 +1161,7 @@ function getToken(reqPath, options, tokenSchema, bodyString, callProperties, cal
|
|
|
1153
1161
|
// do not make the call to return a token if the request is actually
|
|
1154
1162
|
// to get a token. Getting a token to get a token -- that should go
|
|
1155
1163
|
// direct to make request
|
|
1156
|
-
return callback({ token: 'faketoken' });
|
|
1164
|
+
return callback({ token: 'faketoken', tokenp2: 'faketoken' });
|
|
1157
1165
|
}
|
|
1158
1166
|
|
|
1159
1167
|
log.debug(`${origin}: OPTIONS: ${JSON.stringify(options)}`);
|
|
@@ -1857,11 +1865,12 @@ function buildTokenRequest(reqPath, reqBody, callProperties, callback) {
|
|
|
1857
1865
|
let bodyString = null;
|
|
1858
1866
|
|
|
1859
1867
|
// if we have been passed a schema and the Authorization is in a header
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1868
|
+
// COMMENTED OUT AND HANDLED IN IF BELOW - take stuff out of body on line 1930
|
|
1869
|
+
// if (tokenSchema && tokenSchema.headers && tokenSchema.headers.Authorization) {
|
|
1870
|
+
// // request the token
|
|
1871
|
+
// options.headers['Content-length'] = 0;
|
|
1872
|
+
// return getToken(reqPath, options, tokenSchema, '', callProperties, callback);
|
|
1873
|
+
// }
|
|
1865
1874
|
if (tokenSchema) {
|
|
1866
1875
|
// if this is a get, need to put the username on the url
|
|
1867
1876
|
if (options.path.indexOf('/{username}') >= 0) {
|
|
@@ -1918,6 +1927,12 @@ function buildTokenRequest(reqPath, reqBody, callProperties, callback) {
|
|
|
1918
1927
|
}
|
|
1919
1928
|
}
|
|
1920
1929
|
|
|
1930
|
+
if (tokenSchema.headers && tokenSchema.headers.Authorization) {
|
|
1931
|
+
// remove the username and password from the creds
|
|
1932
|
+
delete creds.username;
|
|
1933
|
+
delete creds.password;
|
|
1934
|
+
}
|
|
1935
|
+
|
|
1921
1936
|
// map the data we received to an Entity - will get back the defaults
|
|
1922
1937
|
const tokenEntity = transUtilInst.mapToOutboundEntity(creds, tokenSchema.requestSchema);
|
|
1923
1938
|
bodyString = tokenEntity;
|
|
@@ -2109,6 +2124,9 @@ function getTokenItem(pathForToken, user, reqBody, invalidToken, callProperties,
|
|
|
2109
2124
|
if (berror) {
|
|
2110
2125
|
done(null, berror);
|
|
2111
2126
|
}
|
|
2127
|
+
if (!dyntoken) {
|
|
2128
|
+
done(null, 'No Token returned');
|
|
2129
|
+
}
|
|
2112
2130
|
|
|
2113
2131
|
let timeout = tokenTimeout;
|
|
2114
2132
|
|
|
@@ -2381,6 +2399,9 @@ function requestAuthenticate(request, entitySchema, invalidToken, callProperties
|
|
|
2381
2399
|
if (berror) {
|
|
2382
2400
|
return callback(null, berror);
|
|
2383
2401
|
}
|
|
2402
|
+
if (!dyntoken) {
|
|
2403
|
+
return callback(null, 'No Token returned');
|
|
2404
|
+
}
|
|
2384
2405
|
|
|
2385
2406
|
// format the authentication string
|
|
2386
2407
|
const tokenObj = {
|
package/package.json
CHANGED