@ama-sdk/core 12.1.10 → 12.1.12
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
|
@@ -99,7 +99,7 @@ function _object_spread_props(target, source) {
|
|
|
99
99
|
return target;
|
|
100
100
|
}
|
|
101
101
|
function _ts_generator(thisArg, body) {
|
|
102
|
-
var f, y, t,
|
|
102
|
+
var f, y, t, _ = {
|
|
103
103
|
label: 0,
|
|
104
104
|
sent: function() {
|
|
105
105
|
if (t[0] & 1) throw t[1];
|
|
@@ -107,12 +107,8 @@ function _ts_generator(thisArg, body) {
|
|
|
107
107
|
},
|
|
108
108
|
trys: [],
|
|
109
109
|
ops: []
|
|
110
|
-
};
|
|
111
|
-
return g = {
|
|
112
|
-
next: verb(0),
|
|
113
|
-
"throw": verb(1),
|
|
114
|
-
"return": verb(2)
|
|
115
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
110
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
111
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
116
112
|
return this;
|
|
117
113
|
}), g;
|
|
118
114
|
function verb(n) {
|
|
@@ -125,7 +121,7 @@ function _ts_generator(thisArg, body) {
|
|
|
125
121
|
}
|
|
126
122
|
function step(op) {
|
|
127
123
|
if (f) throw new TypeError("Generator is already executing.");
|
|
128
|
-
while(_)try {
|
|
124
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
129
125
|
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;
|
|
130
126
|
if (y = 0, t) op = [
|
|
131
127
|
op[0] & 2,
|
|
@@ -218,7 +214,6 @@ function _ts_generator(thisArg, body) {
|
|
|
218
214
|
* https://bugs.chromium.org/p/chromium/issues/detail?id=835821
|
|
219
215
|
* To avoid this issue we do a fake fetch call to check whether we can activate it or not in the browser.
|
|
220
216
|
*/ function testKeepAlive() {
|
|
221
|
-
var _this = this;
|
|
222
217
|
return _async_to_generator(function() {
|
|
223
218
|
var customHeaders, e;
|
|
224
219
|
return _ts_generator(this, function(_state) {
|
|
@@ -243,14 +238,14 @@ function _ts_generator(thisArg, body) {
|
|
|
243
238
|
];
|
|
244
239
|
case 2:
|
|
245
240
|
_state.sent();
|
|
246
|
-
|
|
241
|
+
this.active = true;
|
|
247
242
|
return [
|
|
248
243
|
3,
|
|
249
244
|
4
|
|
250
245
|
];
|
|
251
246
|
case 3:
|
|
252
247
|
e = _state.sent();
|
|
253
|
-
|
|
248
|
+
this.active = false;
|
|
254
249
|
return [
|
|
255
250
|
3,
|
|
256
251
|
4
|
|
@@ -261,7 +256,7 @@ function _ts_generator(thisArg, body) {
|
|
|
261
256
|
];
|
|
262
257
|
}
|
|
263
258
|
});
|
|
264
|
-
})();
|
|
259
|
+
}).call(this);
|
|
265
260
|
}
|
|
266
261
|
},
|
|
267
262
|
{
|
|
@@ -28,7 +28,7 @@ function _async_to_generator(fn) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
function _ts_generator(thisArg, body) {
|
|
31
|
-
var f, y, t,
|
|
31
|
+
var f, y, t, _ = {
|
|
32
32
|
label: 0,
|
|
33
33
|
sent: function() {
|
|
34
34
|
if (t[0] & 1) throw t[1];
|
|
@@ -36,12 +36,8 @@ function _ts_generator(thisArg, body) {
|
|
|
36
36
|
},
|
|
37
37
|
trys: [],
|
|
38
38
|
ops: []
|
|
39
|
-
};
|
|
40
|
-
return g = {
|
|
41
|
-
next: verb(0),
|
|
42
|
-
"throw": verb(1),
|
|
43
|
-
"return": verb(2)
|
|
44
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
39
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
40
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
45
41
|
return this;
|
|
46
42
|
}), g;
|
|
47
43
|
function verb(n) {
|
|
@@ -54,7 +50,7 @@ function _ts_generator(thisArg, body) {
|
|
|
54
50
|
}
|
|
55
51
|
function step(op) {
|
|
56
52
|
if (f) throw new TypeError("Generator is already executing.");
|
|
57
|
-
while(_)try {
|
|
53
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
58
54
|
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;
|
|
59
55
|
if (y = 0, t) op = [
|
|
60
56
|
op[0] & 2,
|
|
@@ -129,30 +125,32 @@ describe('Keepalive Request Plugin', function() {
|
|
|
129
125
|
basePath: 'http://test.com/truc',
|
|
130
126
|
method: 'get'
|
|
131
127
|
};
|
|
132
|
-
it('keepalive should be set to true',
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
128
|
+
it('keepalive should be set to true', function() {
|
|
129
|
+
return _async_to_generator(function() {
|
|
130
|
+
var plugin, runner, keepalive;
|
|
131
|
+
return _ts_generator(this, function(_state) {
|
|
132
|
+
switch(_state.label){
|
|
133
|
+
case 0:
|
|
134
|
+
plugin = new KeepaliveRequest(true);
|
|
135
|
+
runner = plugin.load();
|
|
136
|
+
return [
|
|
137
|
+
4,
|
|
138
|
+
runner.transform(options)
|
|
139
|
+
];
|
|
140
|
+
case 1:
|
|
141
|
+
_state.sent();
|
|
142
|
+
return [
|
|
143
|
+
4,
|
|
144
|
+
plugin.load().transform(options)
|
|
145
|
+
];
|
|
146
|
+
case 2:
|
|
147
|
+
keepalive = _state.sent().keepalive;
|
|
148
|
+
expect(keepalive).toBe(true);
|
|
149
|
+
return [
|
|
150
|
+
2
|
|
151
|
+
];
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
})();
|
|
155
|
+
});
|
|
158
156
|
});
|
|
@@ -56,7 +56,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
56
56
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
57
57
|
}
|
|
58
58
|
function _ts_generator(thisArg, body) {
|
|
59
|
-
var f, y, t,
|
|
59
|
+
var f, y, t, _ = {
|
|
60
60
|
label: 0,
|
|
61
61
|
sent: function() {
|
|
62
62
|
if (t[0] & 1) throw t[1];
|
|
@@ -64,12 +64,8 @@ function _ts_generator(thisArg, body) {
|
|
|
64
64
|
},
|
|
65
65
|
trys: [],
|
|
66
66
|
ops: []
|
|
67
|
-
};
|
|
68
|
-
return g = {
|
|
69
|
-
next: verb(0),
|
|
70
|
-
"throw": verb(1),
|
|
71
|
-
"return": verb(2)
|
|
72
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
67
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
68
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
73
69
|
return this;
|
|
74
70
|
}), g;
|
|
75
71
|
function verb(n) {
|
|
@@ -82,7 +78,7 @@ function _ts_generator(thisArg, body) {
|
|
|
82
78
|
}
|
|
83
79
|
function step(op) {
|
|
84
80
|
if (f) throw new TypeError("Generator is already executing.");
|
|
85
|
-
while(_)try {
|
|
81
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
86
82
|
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;
|
|
87
83
|
if (y = 0, t) op = [
|
|
88
84
|
op[0] & 2,
|
|
@@ -151,10 +147,7 @@ function _ts_generator(thisArg, body) {
|
|
|
151
147
|
}
|
|
152
148
|
}
|
|
153
149
|
export function sha256(value) {
|
|
154
|
-
return
|
|
155
|
-
}
|
|
156
|
-
function _sha256() {
|
|
157
|
-
_sha256 = _async_to_generator(function(value) {
|
|
150
|
+
return _async_to_generator(function() {
|
|
158
151
|
var utf8, hashBuffer, hashArray, hashHex;
|
|
159
152
|
return _ts_generator(this, function(_state) {
|
|
160
153
|
switch(_state.label){
|
|
@@ -176,8 +169,7 @@ function _sha256() {
|
|
|
176
169
|
];
|
|
177
170
|
}
|
|
178
171
|
});
|
|
179
|
-
});
|
|
180
|
-
return _sha256.apply(this, arguments);
|
|
172
|
+
})();
|
|
181
173
|
}
|
|
182
174
|
/**
|
|
183
175
|
* Generates hash-based message authentication code using cryptographic hash function HmacSHA256 and the provided
|
|
@@ -186,10 +178,7 @@ function _sha256() {
|
|
|
186
178
|
* @param value Value to hash
|
|
187
179
|
* @param secretKey Secret cryptographic key
|
|
188
180
|
*/ export function hmacSHA256(value, secretKey) {
|
|
189
|
-
return
|
|
190
|
-
}
|
|
191
|
-
function _hmacSHA256() {
|
|
192
|
-
_hmacSHA256 = _async_to_generator(function(value, secretKey) {
|
|
181
|
+
return _async_to_generator(function() {
|
|
193
182
|
var _String, enc, algorithm, key, signature, digest;
|
|
194
183
|
return _ts_generator(this, function(_state) {
|
|
195
184
|
switch(_state.label){
|
|
@@ -221,6 +210,5 @@ function _hmacSHA256() {
|
|
|
221
210
|
];
|
|
222
211
|
}
|
|
223
212
|
});
|
|
224
|
-
});
|
|
225
|
-
return _hmacSHA256.apply(this, arguments);
|
|
213
|
+
})();
|
|
226
214
|
}
|
|
@@ -60,7 +60,7 @@ function _define_property(obj, key, value) {
|
|
|
60
60
|
return obj;
|
|
61
61
|
}
|
|
62
62
|
function _ts_generator(thisArg, body) {
|
|
63
|
-
var f, y, t,
|
|
63
|
+
var f, y, t, _ = {
|
|
64
64
|
label: 0,
|
|
65
65
|
sent: function() {
|
|
66
66
|
if (t[0] & 1) throw t[1];
|
|
@@ -68,12 +68,8 @@ function _ts_generator(thisArg, body) {
|
|
|
68
68
|
},
|
|
69
69
|
trys: [],
|
|
70
70
|
ops: []
|
|
71
|
-
};
|
|
72
|
-
return g = {
|
|
73
|
-
next: verb(0),
|
|
74
|
-
"throw": verb(1),
|
|
75
|
-
"return": verb(2)
|
|
76
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
71
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
72
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
77
73
|
return this;
|
|
78
74
|
}), g;
|
|
79
75
|
function verb(n) {
|
|
@@ -86,7 +82,7 @@ function _ts_generator(thisArg, body) {
|
|
|
86
82
|
}
|
|
87
83
|
function step(op) {
|
|
88
84
|
if (f) throw new TypeError("Generator is already executing.");
|
|
89
|
-
while(_)try {
|
|
85
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
90
86
|
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;
|
|
91
87
|
if (y = 0, t) op = [
|
|
92
88
|
op[0] & 2,
|
|
@@ -236,14 +232,13 @@ import { hmacSHA256, sha256 } from './mgw-mdw-auth.helpers';
|
|
|
236
232
|
* @param payload JWT payload
|
|
237
233
|
* @param basePath Resource path
|
|
238
234
|
*/ function generateMicroGatewayAuthenticationSignatureKey(payload, basePath) {
|
|
239
|
-
var _this = this;
|
|
240
235
|
return _async_to_generator(function() {
|
|
241
236
|
var subKeyString, keyString, _;
|
|
242
237
|
return _ts_generator(this, function(_state) {
|
|
243
238
|
switch(_state.label){
|
|
244
239
|
case 0:
|
|
245
|
-
subKeyString =
|
|
246
|
-
_ =
|
|
240
|
+
subKeyString = this.secret + payload.jti + payload.iat + basePath;
|
|
241
|
+
_ = this.apiKey;
|
|
247
242
|
return [
|
|
248
243
|
4,
|
|
249
244
|
sha256(subKeyString)
|
|
@@ -256,7 +251,7 @@ import { hmacSHA256, sha256 } from './mgw-mdw-auth.helpers';
|
|
|
256
251
|
];
|
|
257
252
|
}
|
|
258
253
|
});
|
|
259
|
-
})();
|
|
254
|
+
}).call(this);
|
|
260
255
|
}
|
|
261
256
|
},
|
|
262
257
|
{
|
|
@@ -266,13 +261,12 @@ import { hmacSHA256, sha256 } from './mgw-mdw-auth.helpers';
|
|
|
266
261
|
* @param payload JWT payload
|
|
267
262
|
* @param secretKey secret key used to generate the signature
|
|
268
263
|
*/ function sign(payload, secretKey) {
|
|
269
|
-
var _this = this;
|
|
270
264
|
return _async_to_generator(function() {
|
|
271
265
|
var message, signature, encodedSignature;
|
|
272
266
|
return _ts_generator(this, function(_state) {
|
|
273
267
|
switch(_state.label){
|
|
274
268
|
case 0:
|
|
275
|
-
message = "".concat(
|
|
269
|
+
message = "".concat(this.base64UrlEncoder(JSON.stringify(jwsHeader)), ".").concat(this.base64UrlEncoder(JSON.stringify(payload)));
|
|
276
270
|
return [
|
|
277
271
|
4,
|
|
278
272
|
hmacSHA256(message, secretKey)
|
|
@@ -286,7 +280,7 @@ import { hmacSHA256, sha256 } from './mgw-mdw-auth.helpers';
|
|
|
286
280
|
];
|
|
287
281
|
}
|
|
288
282
|
});
|
|
289
|
-
})();
|
|
283
|
+
}).call(this);
|
|
290
284
|
}
|
|
291
285
|
},
|
|
292
286
|
{
|
|
@@ -295,26 +289,25 @@ import { hmacSHA256, sha256 } from './mgw-mdw-auth.helpers';
|
|
|
295
289
|
* Generates a signed Json Web Token
|
|
296
290
|
* @param path Resource path
|
|
297
291
|
*/ function generateJWS(path) {
|
|
298
|
-
var _this = this;
|
|
299
292
|
return _async_to_generator(function() {
|
|
300
293
|
var payload, secretKey;
|
|
301
294
|
return _ts_generator(this, function(_state) {
|
|
302
295
|
switch(_state.label){
|
|
303
296
|
case 0:
|
|
304
|
-
payload =
|
|
297
|
+
payload = this.generatePayload();
|
|
305
298
|
return [
|
|
306
299
|
4,
|
|
307
|
-
|
|
300
|
+
this.generateMicroGatewayAuthenticationSignatureKey(payload, path)
|
|
308
301
|
];
|
|
309
302
|
case 1:
|
|
310
303
|
secretKey = _state.sent();
|
|
311
304
|
return [
|
|
312
305
|
2,
|
|
313
|
-
|
|
306
|
+
this.sign(payload, secretKey)
|
|
314
307
|
];
|
|
315
308
|
}
|
|
316
309
|
});
|
|
317
|
-
})();
|
|
310
|
+
}).call(this);
|
|
318
311
|
}
|
|
319
312
|
},
|
|
320
313
|
{
|
|
@@ -322,8 +315,8 @@ import { hmacSHA256, sha256 } from './mgw-mdw-auth.helpers';
|
|
|
322
315
|
value: function load() {
|
|
323
316
|
var _this = this;
|
|
324
317
|
return {
|
|
325
|
-
transform:
|
|
326
|
-
|
|
318
|
+
transform: function(data) {
|
|
319
|
+
return _async_to_generator(function() {
|
|
327
320
|
var url, token;
|
|
328
321
|
return _ts_generator(this, function(_state) {
|
|
329
322
|
switch(_state.label){
|
|
@@ -332,7 +325,7 @@ import { hmacSHA256, sha256 } from './mgw-mdw-auth.helpers';
|
|
|
332
325
|
url = new URL(data.basePath);
|
|
333
326
|
return [
|
|
334
327
|
4,
|
|
335
|
-
|
|
328
|
+
this.generateJWS(url.pathname)
|
|
336
329
|
];
|
|
337
330
|
case 1:
|
|
338
331
|
token = _state.sent();
|
|
@@ -343,11 +336,8 @@ import { hmacSHA256, sha256 } from './mgw-mdw-auth.helpers';
|
|
|
343
336
|
];
|
|
344
337
|
}
|
|
345
338
|
});
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
return _ref.apply(this, arguments);
|
|
349
|
-
};
|
|
350
|
-
}()
|
|
339
|
+
}).call(_this);
|
|
340
|
+
}
|
|
351
341
|
};
|
|
352
342
|
}
|
|
353
343
|
}
|