@ama-sdk/core 12.1.8 → 12.1.11
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/cjs/clients/api-angular-client.js +13 -18
- package/cjs/clients/api-fetch-client.js +16 -21
- package/cjs/fwk/api.helpers.js +11 -11
- package/cjs/fwk/date.js +5 -5
- package/cjs/fwk/errors.js +7 -7
- package/cjs/fwk/mocks/alf-mock-adapter.js +58 -60
- package/cjs/fwk/mocks/base-mock-adapter.js +15 -19
- package/cjs/fwk/mocks/helpers.js +3 -3
- package/cjs/fwk/param-serialization.js +6 -6
- package/cjs/fwk/reviver.js +4 -4
- package/cjs/plugins/abort/abort.spec.js +83 -81
- package/cjs/plugins/additional-params/additional-params.request.js +18 -25
- package/cjs/plugins/additional-params/additional-params.spec.js +194 -186
- package/cjs/plugins/api-configuration-override/api-configuration-override.request.js +10 -17
- package/cjs/plugins/api-configuration-override/api-configuration-override.spec.js +83 -81
- package/cjs/plugins/api-key/api-key.request.js +12 -19
- package/cjs/plugins/api-key/api-key.spec.js +50 -50
- package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +25 -36
- package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +343 -327
- package/cjs/plugins/client-facts/client-facts.request.js +18 -25
- package/cjs/plugins/client-facts/client-facts.spec.js +218 -208
- package/cjs/plugins/concurrent/concurrent.fetch.js +12 -20
- package/cjs/plugins/concurrent/concurrent.spec.js +99 -99
- package/cjs/plugins/custom-info/custom-info.spec.js +90 -90
- package/cjs/plugins/fetch-cache/fetch-cache.spec.js +100 -98
- package/cjs/plugins/fetch-credentials/fetch-credentials.spec.js +60 -60
- package/cjs/plugins/json-token/json-token.spec.js +109 -107
- package/cjs/plugins/keepalive/keepalive.request.js +7 -12
- package/cjs/plugins/keepalive/keepalive.spec.js +32 -34
- package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.helpers.js +11 -23
- package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +18 -28
- package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +212 -204
- package/cjs/plugins/mock-intercept/mock-intercept.angular.js +94 -100
- package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +15 -22
- package/cjs/plugins/mock-intercept/mock-intercept.interface.js +3 -3
- package/cjs/plugins/mock-intercept/mock-intercept.request.js +12 -19
- package/cjs/plugins/mock-intercept/mock-intercept.spec.js +245 -237
- package/cjs/plugins/perf-metric/perf-metric.fetch.js +11 -18
- package/cjs/plugins/pii-tokenizer/pii-tokenizer.request.js +19 -27
- package/cjs/plugins/pii-tokenizer/pii-tokenizer.spec.js +404 -386
- package/cjs/plugins/raw-response-info/raw-response-info.spec.js +67 -67
- package/cjs/plugins/retry/retry.fetch.js +18 -27
- package/cjs/plugins/retry/retry.spec.js +233 -225
- package/cjs/plugins/reviver/reviver.spec.js +88 -86
- package/cjs/plugins/session-id/session-id.spec.js +98 -94
- package/cjs/plugins/si-token/si-token.spec.js +27 -29
- package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +17 -24
- package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +199 -191
- package/cjs/plugins/timeout/timeout.fetch.js +16 -22
- package/cjs/plugins/timeout/timeout.spec.js +211 -205
- package/cjs/plugins/url-rewrite/url-rewrite.request.js +9 -16
- package/cjs/plugins/url-rewrite/url-rewrite.spec.js +48 -48
- package/cjs/plugins/wait-for/wait-for.fetch.js +19 -29
- package/cjs/plugins/wait-for/wait-for.spec.js +211 -203
- package/cjs/utils/crypto.js +15 -27
- package/cjs/utils/generic-api.js +9 -14
- package/cjs/utils/json-token.js +19 -26
- package/cjs/utils/json-token.spec.js +495 -497
- package/cjs/utils/mime-types.js +3 -3
- package/esm2015/clients/api-angular-client.js +13 -18
- package/esm2015/clients/api-fetch-client.js +16 -21
- package/esm2015/fwk/mocks/alf-mock-adapter.js +58 -60
- package/esm2015/fwk/mocks/base-mock-adapter.js +15 -19
- package/esm2015/plugins/abort/abort.spec.js +83 -81
- package/esm2015/plugins/additional-params/additional-params.request.js +15 -22
- package/esm2015/plugins/additional-params/additional-params.spec.js +194 -186
- package/esm2015/plugins/api-configuration-override/api-configuration-override.request.js +10 -17
- package/esm2015/plugins/api-configuration-override/api-configuration-override.spec.js +83 -81
- package/esm2015/plugins/api-key/api-key.request.js +12 -19
- package/esm2015/plugins/api-key/api-key.spec.js +50 -50
- package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +21 -32
- package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +343 -327
- package/esm2015/plugins/client-facts/client-facts.request.js +15 -22
- package/esm2015/plugins/client-facts/client-facts.spec.js +218 -208
- package/esm2015/plugins/concurrent/concurrent.fetch.js +12 -20
- package/esm2015/plugins/concurrent/concurrent.spec.js +99 -99
- package/esm2015/plugins/custom-info/custom-info.spec.js +90 -90
- package/esm2015/plugins/fetch-cache/fetch-cache.spec.js +100 -98
- package/esm2015/plugins/fetch-credentials/fetch-credentials.spec.js +60 -60
- package/esm2015/plugins/json-token/json-token.spec.js +109 -107
- package/esm2015/plugins/keepalive/keepalive.request.js +7 -12
- package/esm2015/plugins/keepalive/keepalive.spec.js +32 -34
- package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.helpers.js +8 -20
- package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +18 -28
- package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +212 -204
- package/esm2015/plugins/mock-intercept/mock-intercept.angular.js +94 -100
- package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +15 -22
- package/esm2015/plugins/mock-intercept/mock-intercept.request.js +12 -19
- package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +245 -237
- package/esm2015/plugins/perf-metric/perf-metric.fetch.js +11 -18
- package/esm2015/plugins/pii-tokenizer/pii-tokenizer.request.js +15 -23
- package/esm2015/plugins/pii-tokenizer/pii-tokenizer.spec.js +404 -386
- package/esm2015/plugins/raw-response-info/raw-response-info.spec.js +67 -67
- package/esm2015/plugins/retry/retry.fetch.js +18 -27
- package/esm2015/plugins/retry/retry.spec.js +233 -225
- package/esm2015/plugins/reviver/reviver.spec.js +88 -86
- package/esm2015/plugins/session-id/session-id.spec.js +98 -94
- package/esm2015/plugins/si-token/si-token.spec.js +27 -29
- package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +17 -24
- package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +199 -191
- package/esm2015/plugins/timeout/timeout.fetch.js +13 -19
- package/esm2015/plugins/timeout/timeout.spec.js +211 -205
- package/esm2015/plugins/url-rewrite/url-rewrite.request.js +9 -16
- package/esm2015/plugins/url-rewrite/url-rewrite.spec.js +48 -48
- package/esm2015/plugins/wait-for/wait-for.fetch.js +19 -29
- package/esm2015/plugins/wait-for/wait-for.spec.js +211 -203
- package/esm2015/utils/crypto.js +8 -20
- package/esm2015/utils/generic-api.js +9 -14
- package/esm2015/utils/json-token.js +10 -17
- package/esm2015/utils/json-token.spec.js +495 -497
- package/package.json +6 -6
|
@@ -109,7 +109,7 @@ function _object_spread_props(target, source) {
|
|
|
109
109
|
return target;
|
|
110
110
|
}
|
|
111
111
|
function _ts_generator(thisArg, body) {
|
|
112
|
-
var f, y, t,
|
|
112
|
+
var f, y, t, _ = {
|
|
113
113
|
label: 0,
|
|
114
114
|
sent: function() {
|
|
115
115
|
if (t[0] & 1) throw t[1];
|
|
@@ -117,12 +117,8 @@ function _ts_generator(thisArg, body) {
|
|
|
117
117
|
},
|
|
118
118
|
trys: [],
|
|
119
119
|
ops: []
|
|
120
|
-
};
|
|
121
|
-
return g = {
|
|
122
|
-
next: verb(0),
|
|
123
|
-
"throw": verb(1),
|
|
124
|
-
"return": verb(2)
|
|
125
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
120
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
121
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
126
122
|
return this;
|
|
127
123
|
}), g;
|
|
128
124
|
function verb(n) {
|
|
@@ -135,7 +131,7 @@ function _ts_generator(thisArg, body) {
|
|
|
135
131
|
}
|
|
136
132
|
function step(op) {
|
|
137
133
|
if (f) throw new TypeError("Generator is already executing.");
|
|
138
|
-
while(_)try {
|
|
134
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
139
135
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
140
136
|
if (y = 0, t) op = [
|
|
141
137
|
op[0] & 2,
|
|
@@ -225,7 +221,6 @@ var KeepaliveRequest = /*#__PURE__*/ function() {
|
|
|
225
221
|
* https://bugs.chromium.org/p/chromium/issues/detail?id=835821
|
|
226
222
|
* To avoid this issue we do a fake fetch call to check whether we can activate it or not in the browser.
|
|
227
223
|
*/ function testKeepAlive() {
|
|
228
|
-
var _this = this;
|
|
229
224
|
return _async_to_generator(function() {
|
|
230
225
|
var customHeaders, e;
|
|
231
226
|
return _ts_generator(this, function(_state) {
|
|
@@ -250,14 +245,14 @@ var KeepaliveRequest = /*#__PURE__*/ function() {
|
|
|
250
245
|
];
|
|
251
246
|
case 2:
|
|
252
247
|
_state.sent();
|
|
253
|
-
|
|
248
|
+
this.active = true;
|
|
254
249
|
return [
|
|
255
250
|
3,
|
|
256
251
|
4
|
|
257
252
|
];
|
|
258
253
|
case 3:
|
|
259
254
|
e = _state.sent();
|
|
260
|
-
|
|
255
|
+
this.active = false;
|
|
261
256
|
return [
|
|
262
257
|
3,
|
|
263
258
|
4
|
|
@@ -268,7 +263,7 @@ var KeepaliveRequest = /*#__PURE__*/ function() {
|
|
|
268
263
|
];
|
|
269
264
|
}
|
|
270
265
|
});
|
|
271
|
-
})();
|
|
266
|
+
}).call(this);
|
|
272
267
|
}
|
|
273
268
|
},
|
|
274
269
|
{
|
|
@@ -33,7 +33,7 @@ function _async_to_generator(fn) {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
function _ts_generator(thisArg, body) {
|
|
36
|
-
var f, y, t,
|
|
36
|
+
var f, y, t, _ = {
|
|
37
37
|
label: 0,
|
|
38
38
|
sent: function() {
|
|
39
39
|
if (t[0] & 1) throw t[1];
|
|
@@ -41,12 +41,8 @@ function _ts_generator(thisArg, body) {
|
|
|
41
41
|
},
|
|
42
42
|
trys: [],
|
|
43
43
|
ops: []
|
|
44
|
-
};
|
|
45
|
-
return g = {
|
|
46
|
-
next: verb(0),
|
|
47
|
-
"throw": verb(1),
|
|
48
|
-
"return": verb(2)
|
|
49
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
44
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
45
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
50
46
|
return this;
|
|
51
47
|
}), g;
|
|
52
48
|
function verb(n) {
|
|
@@ -59,7 +55,7 @@ function _ts_generator(thisArg, body) {
|
|
|
59
55
|
}
|
|
60
56
|
function step(op) {
|
|
61
57
|
if (f) throw new TypeError("Generator is already executing.");
|
|
62
|
-
while(_)try {
|
|
58
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
63
59
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
64
60
|
if (y = 0, t) op = [
|
|
65
61
|
op[0] & 2,
|
|
@@ -133,30 +129,32 @@ describe('Keepalive Request Plugin', function() {
|
|
|
133
129
|
basePath: 'http://test.com/truc',
|
|
134
130
|
method: 'get'
|
|
135
131
|
};
|
|
136
|
-
it('keepalive should be set to true',
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
132
|
+
it('keepalive should be set to true', function() {
|
|
133
|
+
return _async_to_generator(function() {
|
|
134
|
+
var plugin, runner, keepalive;
|
|
135
|
+
return _ts_generator(this, function(_state) {
|
|
136
|
+
switch(_state.label){
|
|
137
|
+
case 0:
|
|
138
|
+
plugin = new _keepaliverequest.KeepaliveRequest(true);
|
|
139
|
+
runner = plugin.load();
|
|
140
|
+
return [
|
|
141
|
+
4,
|
|
142
|
+
runner.transform(options)
|
|
143
|
+
];
|
|
144
|
+
case 1:
|
|
145
|
+
_state.sent();
|
|
146
|
+
return [
|
|
147
|
+
4,
|
|
148
|
+
plugin.load().transform(options)
|
|
149
|
+
];
|
|
150
|
+
case 2:
|
|
151
|
+
keepalive = _state.sent().keepalive;
|
|
152
|
+
expect(keepalive).toBe(true);
|
|
153
|
+
return [
|
|
154
|
+
2
|
|
155
|
+
];
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
})();
|
|
159
|
+
});
|
|
162
160
|
});
|
|
@@ -8,14 +8,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
function _export(target, all) {
|
|
9
9
|
for(var name in all)Object.defineProperty(target, name, {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: all
|
|
11
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
_export(exports, {
|
|
15
|
-
hmacSHA256
|
|
15
|
+
get hmacSHA256 () {
|
|
16
16
|
return hmacSHA256;
|
|
17
17
|
},
|
|
18
|
-
sha256
|
|
18
|
+
get sha256 () {
|
|
19
19
|
return sha256;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
@@ -74,7 +74,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
74
74
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
75
75
|
}
|
|
76
76
|
function _ts_generator(thisArg, body) {
|
|
77
|
-
var f, y, t,
|
|
77
|
+
var f, y, t, _ = {
|
|
78
78
|
label: 0,
|
|
79
79
|
sent: function() {
|
|
80
80
|
if (t[0] & 1) throw t[1];
|
|
@@ -82,12 +82,8 @@ function _ts_generator(thisArg, body) {
|
|
|
82
82
|
},
|
|
83
83
|
trys: [],
|
|
84
84
|
ops: []
|
|
85
|
-
};
|
|
86
|
-
return g = {
|
|
87
|
-
next: verb(0),
|
|
88
|
-
"throw": verb(1),
|
|
89
|
-
"return": verb(2)
|
|
90
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
85
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
86
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
91
87
|
return this;
|
|
92
88
|
}), g;
|
|
93
89
|
function verb(n) {
|
|
@@ -100,7 +96,7 @@ function _ts_generator(thisArg, body) {
|
|
|
100
96
|
}
|
|
101
97
|
function step(op) {
|
|
102
98
|
if (f) throw new TypeError("Generator is already executing.");
|
|
103
|
-
while(_)try {
|
|
99
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
104
100
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
105
101
|
if (y = 0, t) op = [
|
|
106
102
|
op[0] & 2,
|
|
@@ -169,10 +165,7 @@ function _ts_generator(thisArg, body) {
|
|
|
169
165
|
}
|
|
170
166
|
}
|
|
171
167
|
function sha256(value) {
|
|
172
|
-
return
|
|
173
|
-
}
|
|
174
|
-
function _sha256() {
|
|
175
|
-
_sha256 = _async_to_generator(function(value) {
|
|
168
|
+
return _async_to_generator(function() {
|
|
176
169
|
var utf8, hashBuffer, hashArray, hashHex;
|
|
177
170
|
return _ts_generator(this, function(_state) {
|
|
178
171
|
switch(_state.label){
|
|
@@ -194,14 +187,10 @@ function _sha256() {
|
|
|
194
187
|
];
|
|
195
188
|
}
|
|
196
189
|
});
|
|
197
|
-
});
|
|
198
|
-
return _sha256.apply(this, arguments);
|
|
190
|
+
})();
|
|
199
191
|
}
|
|
200
192
|
function hmacSHA256(value, secretKey) {
|
|
201
|
-
return
|
|
202
|
-
}
|
|
203
|
-
function _hmacSHA256() {
|
|
204
|
-
_hmacSHA256 = _async_to_generator(function(value, secretKey) {
|
|
193
|
+
return _async_to_generator(function() {
|
|
205
194
|
var _String, enc, algorithm, key, signature, digest;
|
|
206
195
|
return _ts_generator(this, function(_state) {
|
|
207
196
|
switch(_state.label){
|
|
@@ -233,6 +222,5 @@ function _hmacSHA256() {
|
|
|
233
222
|
];
|
|
234
223
|
}
|
|
235
224
|
});
|
|
236
|
-
});
|
|
237
|
-
return _hmacSHA256.apply(this, arguments);
|
|
225
|
+
})();
|
|
238
226
|
}
|
|
@@ -73,7 +73,7 @@ function _define_property(obj, key, value) {
|
|
|
73
73
|
return obj;
|
|
74
74
|
}
|
|
75
75
|
function _ts_generator(thisArg, body) {
|
|
76
|
-
var f, y, t,
|
|
76
|
+
var f, y, t, _ = {
|
|
77
77
|
label: 0,
|
|
78
78
|
sent: function() {
|
|
79
79
|
if (t[0] & 1) throw t[1];
|
|
@@ -81,12 +81,8 @@ function _ts_generator(thisArg, body) {
|
|
|
81
81
|
},
|
|
82
82
|
trys: [],
|
|
83
83
|
ops: []
|
|
84
|
-
};
|
|
85
|
-
return g = {
|
|
86
|
-
next: verb(0),
|
|
87
|
-
"throw": verb(1),
|
|
88
|
-
"return": verb(2)
|
|
89
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
84
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
85
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
90
86
|
return this;
|
|
91
87
|
}), g;
|
|
92
88
|
function verb(n) {
|
|
@@ -99,7 +95,7 @@ function _ts_generator(thisArg, body) {
|
|
|
99
95
|
}
|
|
100
96
|
function step(op) {
|
|
101
97
|
if (f) throw new TypeError("Generator is already executing.");
|
|
102
|
-
while(_)try {
|
|
98
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
103
99
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
104
100
|
if (y = 0, t) op = [
|
|
105
101
|
op[0] & 2,
|
|
@@ -243,14 +239,13 @@ var MicroGatewayMiddlewareAuthenticationRequest = /*#__PURE__*/ function() {
|
|
|
243
239
|
* @param payload JWT payload
|
|
244
240
|
* @param basePath Resource path
|
|
245
241
|
*/ function generateMicroGatewayAuthenticationSignatureKey(payload, basePath) {
|
|
246
|
-
var _this = this;
|
|
247
242
|
return _async_to_generator(function() {
|
|
248
243
|
var subKeyString, keyString, _;
|
|
249
244
|
return _ts_generator(this, function(_state) {
|
|
250
245
|
switch(_state.label){
|
|
251
246
|
case 0:
|
|
252
|
-
subKeyString =
|
|
253
|
-
_ =
|
|
247
|
+
subKeyString = this.secret + payload.jti + payload.iat + basePath;
|
|
248
|
+
_ = this.apiKey;
|
|
254
249
|
return [
|
|
255
250
|
4,
|
|
256
251
|
(0, _mgwmdwauthhelpers.sha256)(subKeyString)
|
|
@@ -263,7 +258,7 @@ var MicroGatewayMiddlewareAuthenticationRequest = /*#__PURE__*/ function() {
|
|
|
263
258
|
];
|
|
264
259
|
}
|
|
265
260
|
});
|
|
266
|
-
})();
|
|
261
|
+
}).call(this);
|
|
267
262
|
}
|
|
268
263
|
},
|
|
269
264
|
{
|
|
@@ -273,13 +268,12 @@ var MicroGatewayMiddlewareAuthenticationRequest = /*#__PURE__*/ function() {
|
|
|
273
268
|
* @param payload JWT payload
|
|
274
269
|
* @param secretKey secret key used to generate the signature
|
|
275
270
|
*/ function sign(payload, secretKey) {
|
|
276
|
-
var _this = this;
|
|
277
271
|
return _async_to_generator(function() {
|
|
278
272
|
var message, signature, encodedSignature;
|
|
279
273
|
return _ts_generator(this, function(_state) {
|
|
280
274
|
switch(_state.label){
|
|
281
275
|
case 0:
|
|
282
|
-
message = "".concat(
|
|
276
|
+
message = "".concat(this.base64UrlEncoder(JSON.stringify(jwsHeader)), ".").concat(this.base64UrlEncoder(JSON.stringify(payload)));
|
|
283
277
|
return [
|
|
284
278
|
4,
|
|
285
279
|
(0, _mgwmdwauthhelpers.hmacSHA256)(message, secretKey)
|
|
@@ -293,7 +287,7 @@ var MicroGatewayMiddlewareAuthenticationRequest = /*#__PURE__*/ function() {
|
|
|
293
287
|
];
|
|
294
288
|
}
|
|
295
289
|
});
|
|
296
|
-
})();
|
|
290
|
+
}).call(this);
|
|
297
291
|
}
|
|
298
292
|
},
|
|
299
293
|
{
|
|
@@ -302,26 +296,25 @@ var MicroGatewayMiddlewareAuthenticationRequest = /*#__PURE__*/ function() {
|
|
|
302
296
|
* Generates a signed Json Web Token
|
|
303
297
|
* @param path Resource path
|
|
304
298
|
*/ function generateJWS(path) {
|
|
305
|
-
var _this = this;
|
|
306
299
|
return _async_to_generator(function() {
|
|
307
300
|
var payload, secretKey;
|
|
308
301
|
return _ts_generator(this, function(_state) {
|
|
309
302
|
switch(_state.label){
|
|
310
303
|
case 0:
|
|
311
|
-
payload =
|
|
304
|
+
payload = this.generatePayload();
|
|
312
305
|
return [
|
|
313
306
|
4,
|
|
314
|
-
|
|
307
|
+
this.generateMicroGatewayAuthenticationSignatureKey(payload, path)
|
|
315
308
|
];
|
|
316
309
|
case 1:
|
|
317
310
|
secretKey = _state.sent();
|
|
318
311
|
return [
|
|
319
312
|
2,
|
|
320
|
-
|
|
313
|
+
this.sign(payload, secretKey)
|
|
321
314
|
];
|
|
322
315
|
}
|
|
323
316
|
});
|
|
324
|
-
})();
|
|
317
|
+
}).call(this);
|
|
325
318
|
}
|
|
326
319
|
},
|
|
327
320
|
{
|
|
@@ -329,8 +322,8 @@ var MicroGatewayMiddlewareAuthenticationRequest = /*#__PURE__*/ function() {
|
|
|
329
322
|
value: function load() {
|
|
330
323
|
var _this = this;
|
|
331
324
|
return {
|
|
332
|
-
transform:
|
|
333
|
-
|
|
325
|
+
transform: function(data) {
|
|
326
|
+
return _async_to_generator(function() {
|
|
334
327
|
var url, token;
|
|
335
328
|
return _ts_generator(this, function(_state) {
|
|
336
329
|
switch(_state.label){
|
|
@@ -339,7 +332,7 @@ var MicroGatewayMiddlewareAuthenticationRequest = /*#__PURE__*/ function() {
|
|
|
339
332
|
url = new URL(data.basePath);
|
|
340
333
|
return [
|
|
341
334
|
4,
|
|
342
|
-
|
|
335
|
+
this.generateJWS(url.pathname)
|
|
343
336
|
];
|
|
344
337
|
case 1:
|
|
345
338
|
token = _state.sent();
|
|
@@ -350,11 +343,8 @@ var MicroGatewayMiddlewareAuthenticationRequest = /*#__PURE__*/ function() {
|
|
|
350
343
|
];
|
|
351
344
|
}
|
|
352
345
|
});
|
|
353
|
-
});
|
|
354
|
-
|
|
355
|
-
return _ref.apply(this, arguments);
|
|
356
|
-
};
|
|
357
|
-
}()
|
|
346
|
+
}).call(_this);
|
|
347
|
+
}
|
|
358
348
|
};
|
|
359
349
|
}
|
|
360
350
|
}
|