@boxyhq/saml-jackson 0.3.6-beta.658 → 0.3.6-beta.659
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/dist/controller/api.d.ts +6 -1
- package/dist/controller/api.js +17 -6
- package/package.json +1 -1
package/dist/controller/api.d.ts
CHANGED
@@ -99,6 +99,11 @@ export declare class APIController implements IAPIController {
|
|
99
99
|
* type: string
|
100
100
|
* in: formData
|
101
101
|
* required: true
|
102
|
+
* - name: clientSecret
|
103
|
+
* description: Client Secret for the config
|
104
|
+
* type: string
|
105
|
+
* in: formData
|
106
|
+
* required: true
|
102
107
|
* - name: name
|
103
108
|
* description: Name/identifier for the config
|
104
109
|
* type: string
|
@@ -147,7 +152,7 @@ export declare class APIController implements IAPIController {
|
|
147
152
|
* 204:
|
148
153
|
* description: Success
|
149
154
|
* 400:
|
150
|
-
* description: Please provide clientID
|
155
|
+
* description: Please provide clientID | Please provide clientSecret | clientSecret mismatch | Tenant/Product config mismatch with IdP metadata
|
151
156
|
* 401:
|
152
157
|
* description: Unauthorized
|
153
158
|
*/
|
package/dist/controller/api.js
CHANGED
@@ -222,6 +222,11 @@ class APIController {
|
|
222
222
|
* type: string
|
223
223
|
* in: formData
|
224
224
|
* required: true
|
225
|
+
* - name: clientSecret
|
226
|
+
* description: Client Secret for the config
|
227
|
+
* type: string
|
228
|
+
* in: formData
|
229
|
+
* required: true
|
225
230
|
* - name: name
|
226
231
|
* description: Name/identifier for the config
|
227
232
|
* type: string
|
@@ -270,19 +275,26 @@ class APIController {
|
|
270
275
|
* 204:
|
271
276
|
* description: Success
|
272
277
|
* 400:
|
273
|
-
* description: Please provide clientID
|
278
|
+
* description: Please provide clientID | Please provide clientSecret | clientSecret mismatch | Tenant/Product config mismatch with IdP metadata
|
274
279
|
* 401:
|
275
280
|
* description: Unauthorized
|
276
281
|
*/
|
277
282
|
updateConfig(body) {
|
278
283
|
var _a;
|
279
284
|
return __awaiter(this, void 0, void 0, function* () {
|
280
|
-
const { encodedRawMetadata, // could be
|
281
|
-
rawMetadata, // could be
|
285
|
+
const { encodedRawMetadata, // could be empty
|
286
|
+
rawMetadata, // could be empty
|
282
287
|
defaultRedirectUrl, redirectUrl, name, description } = body, clientInfo = __rest(body, ["encodedRawMetadata", "rawMetadata", "defaultRedirectUrl", "redirectUrl", "name", "description"]);
|
283
288
|
if (!(clientInfo === null || clientInfo === void 0 ? void 0 : clientInfo.clientID)) {
|
284
289
|
throw new error_1.JacksonError('Please provide clientID', 400);
|
285
290
|
}
|
291
|
+
if (!(clientInfo === null || clientInfo === void 0 ? void 0 : clientInfo.clientSecret)) {
|
292
|
+
throw new error_1.JacksonError('Please provide clientSecret', 400);
|
293
|
+
}
|
294
|
+
const _currentConfig = (_a = (yield this.getConfig(clientInfo))) === null || _a === void 0 ? void 0 : _a.config;
|
295
|
+
if (_currentConfig.clientSecret !== (clientInfo === null || clientInfo === void 0 ? void 0 : clientInfo.clientSecret)) {
|
296
|
+
throw new error_1.JacksonError('clientSecret mismatch', 400);
|
297
|
+
}
|
286
298
|
let metaData = rawMetadata;
|
287
299
|
if (encodedRawMetadata) {
|
288
300
|
metaData = Buffer.from(encodedRawMetadata, 'base64').toString();
|
@@ -301,10 +313,9 @@ class APIController {
|
|
301
313
|
// check if clientID matches with new metadata payload
|
302
314
|
const clientID = dbutils.keyDigest(dbutils.keyFromParts(clientInfo.tenant, clientInfo.product, newMetadata.entityID));
|
303
315
|
if (clientID !== (clientInfo === null || clientInfo === void 0 ? void 0 : clientInfo.clientID)) {
|
304
|
-
throw new error_1.JacksonError('Tenant/Product config mismatch with IdP metadata');
|
316
|
+
throw new error_1.JacksonError('Tenant/Product config mismatch with IdP metadata', 400);
|
305
317
|
}
|
306
318
|
}
|
307
|
-
const _currentConfig = (_a = (yield this.getConfig(clientInfo))) === null || _a === void 0 ? void 0 : _a.config;
|
308
319
|
yield this.configStore.put(clientInfo === null || clientInfo === void 0 ? void 0 : clientInfo.clientID, Object.assign(Object.assign({}, _currentConfig), { name: name ? name : _currentConfig.name, description: description ? description : _currentConfig.description, idpMetadata: newMetadata ? newMetadata : _currentConfig.idpMetadata, defaultRedirectUrl: defaultRedirectUrl ? defaultRedirectUrl : _currentConfig.defaultRedirectUrl, redirectUrl: redirectUrl ? JSON.parse(redirectUrl) : _currentConfig.redirectUrl }), {
|
309
320
|
// secondary index on entityID
|
310
321
|
name: utils_1.IndexNames.EntityID,
|
@@ -446,7 +457,7 @@ class APIController {
|
|
446
457
|
yield this.configStore.delete(clientID);
|
447
458
|
}
|
448
459
|
else {
|
449
|
-
throw new error_1.JacksonError('clientSecret mismatch
|
460
|
+
throw new error_1.JacksonError('clientSecret mismatch', 400);
|
450
461
|
}
|
451
462
|
return;
|
452
463
|
}
|