@boxyhq/saml-jackson 0.3.7-beta.733 → 0.3.7-beta.746
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 -122
- package/dist/controller/api.js +10 -195
- package/dist/controller/oauth.d.ts +0 -1
- package/dist/controller/oauth.js +7 -31
- package/dist/controller/utils.d.ts +0 -1
- package/dist/controller/utils.js +1 -25
- package/dist/db/db.d.ts +0 -1
- package/dist/db/db.js +0 -9
- package/dist/db/mem.d.ts +0 -1
- package/dist/db/mem.js +0 -19
- package/dist/db/mongo.d.ts +0 -1
- package/dist/db/mongo.js +2 -23
- package/dist/db/redis.d.ts +0 -1
- package/dist/db/redis.js +0 -20
- package/dist/db/sql/entity/JacksonStore.d.ts +0 -2
- package/dist/db/sql/entity/JacksonStore.js +0 -13
- package/dist/db/sql/sql.d.ts +0 -1
- package/dist/db/sql/sql.js +1 -18
- package/dist/db/store.js +0 -5
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -3
- package/dist/saml/saml.js +1 -1
- package/dist/typings.d.ts +2 -11
- package/package.json +7 -4
- package/dist/controller/admin.d.ts +0 -8
- package/dist/controller/admin.js +0 -27
- package/migration/mariadb/1644332636666-createdAt.ts +0 -16
- package/migration/mysql/1644332641078-createdAt.ts +0 -16
- package/migration/postgres/1644332647279-createdAt.ts +0 -16
package/dist/controller/api.d.ts
CHANGED
@@ -18,24 +18,10 @@ export declare class APIController implements IAPIController {
|
|
18
18
|
* consumes:
|
19
19
|
* - application/x-www-form-urlencoded
|
20
20
|
* parameters:
|
21
|
-
* - name: name
|
22
|
-
* description: Name/identifier for the config
|
23
|
-
* type: string
|
24
|
-
* in: formData
|
25
|
-
* required: true
|
26
|
-
* example: cal-saml-config
|
27
|
-
* - name: description
|
28
|
-
* description: A short description for the config not more than 100 characters
|
29
|
-
* type: string
|
30
|
-
* in: formData
|
31
|
-
* example: SAML login for cal.com app
|
32
21
|
* - name: encodedRawMetadata
|
33
22
|
* description: Base64 encoding of the XML metadata
|
34
23
|
* in: formData
|
35
|
-
*
|
36
|
-
* - name: rawMetadata
|
37
|
-
* description: Raw XML metadata
|
38
|
-
* in: formData
|
24
|
+
* required: true
|
39
25
|
* type: string
|
40
26
|
* - name: defaultRedirectUrl
|
41
27
|
* description: The redirect URL to use in the IdP login flow
|
@@ -77,86 +63,10 @@ export declare class APIController implements IAPIController {
|
|
77
63
|
* client_id: 8958e13053832b5af58fdf2ee83f35f5d013dc74
|
78
64
|
* client_secret: 13f01f4df5b01770c616e682d14d3ba23f20948cfa89b1d7
|
79
65
|
* type: accounts.google.com
|
80
|
-
* 400:
|
81
|
-
* description: Please provide rawMetadata or encodedRawMetadata | Please provide a defaultRedirectUrl | Please provide redirectUrl | Please provide tenant | Please provide product | Please provide a friendly name | Description should not exceed 100 characters
|
82
66
|
* 401:
|
83
67
|
* description: Unauthorized
|
84
68
|
*/
|
85
69
|
config(body: IdPConfig): Promise<OAuth>;
|
86
|
-
/**
|
87
|
-
* @swagger
|
88
|
-
*
|
89
|
-
* /api/v1/saml/config:
|
90
|
-
* patch:
|
91
|
-
* summary: Update SAML configuration
|
92
|
-
* operationId: update-saml-config
|
93
|
-
* tags: [SAML Config]
|
94
|
-
* consumes:
|
95
|
-
* - application/json
|
96
|
-
* - application/x-www-form-urlencoded
|
97
|
-
* parameters:
|
98
|
-
* - name: clientID
|
99
|
-
* description: Client ID for the config
|
100
|
-
* type: string
|
101
|
-
* in: formData
|
102
|
-
* required: true
|
103
|
-
* - name: clientSecret
|
104
|
-
* description: Client Secret for the config
|
105
|
-
* type: string
|
106
|
-
* in: formData
|
107
|
-
* required: true
|
108
|
-
* - name: name
|
109
|
-
* description: Name/identifier for the config
|
110
|
-
* type: string
|
111
|
-
* in: formData
|
112
|
-
* required: true
|
113
|
-
* example: cal-saml-config
|
114
|
-
* - name: description
|
115
|
-
* description: A short description for the config not more than 100 characters
|
116
|
-
* type: string
|
117
|
-
* in: formData
|
118
|
-
* example: SAML login for cal.com app
|
119
|
-
* - name: encodedRawMetadata
|
120
|
-
* description: Base64 encoding of the XML metadata
|
121
|
-
* in: formData
|
122
|
-
* type: string
|
123
|
-
* - name: rawMetadata
|
124
|
-
* description: Raw XML metadata
|
125
|
-
* in: formData
|
126
|
-
* type: string
|
127
|
-
* - name: defaultRedirectUrl
|
128
|
-
* description: The redirect URL to use in the IdP login flow
|
129
|
-
* in: formData
|
130
|
-
* required: true
|
131
|
-
* type: string
|
132
|
-
* example: http://localhost:3000/login/saml
|
133
|
-
* - name: redirectUrl
|
134
|
-
* description: JSON encoded array containing a list of allowed redirect URLs
|
135
|
-
* in: formData
|
136
|
-
* required: true
|
137
|
-
* type: string
|
138
|
-
* example: '["http://localhost:3000/*"]'
|
139
|
-
* - name: tenant
|
140
|
-
* description: Tenant
|
141
|
-
* in: formData
|
142
|
-
* required: true
|
143
|
-
* type: string
|
144
|
-
* example: boxyhq.com
|
145
|
-
* - name: product
|
146
|
-
* description: Product
|
147
|
-
* in: formData
|
148
|
-
* required: true
|
149
|
-
* type: string
|
150
|
-
* example: demo
|
151
|
-
* responses:
|
152
|
-
* 204:
|
153
|
-
* description: Success
|
154
|
-
* 400:
|
155
|
-
* description: Please provide clientID | Please provide clientSecret | clientSecret mismatch | Tenant/Product config mismatch with IdP metadata | Description should not exceed 100 characters
|
156
|
-
* 401:
|
157
|
-
* description: Unauthorized
|
158
|
-
*/
|
159
|
-
updateConfig(body: any): Promise<void>;
|
160
70
|
/**
|
161
71
|
* @swagger
|
162
72
|
*
|
@@ -186,35 +96,11 @@ export declare class APIController implements IAPIController {
|
|
186
96
|
* description: Success
|
187
97
|
* schema:
|
188
98
|
* type: object
|
99
|
+
* properties:
|
100
|
+
* provider:
|
101
|
+
* type: string
|
189
102
|
* example:
|
190
|
-
*
|
191
|
-
* "config": {
|
192
|
-
* "idpMetadata": {
|
193
|
-
* "sso": {
|
194
|
-
* "postUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxxx/sso/saml",
|
195
|
-
* "redirectUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxxx/sso/saml"
|
196
|
-
* },
|
197
|
-
* "entityID": "http://www.okta.com/xxxxxxxxxxxxx",
|
198
|
-
* "thumbprint": "Eo+eUi3UM3XIMkFFtdVK3yJ5vO9f7YZdasdasdad",
|
199
|
-
* "loginType": "idp",
|
200
|
-
* "provider": "okta.com"
|
201
|
-
* },
|
202
|
-
* "defaultRedirectUrl": "https://hoppscotch.io/",
|
203
|
-
* "redirectUrl": ["https://hoppscotch.io/"],
|
204
|
-
* "tenant": "hoppscotch.io",
|
205
|
-
* "product": "API Engine",
|
206
|
-
* "name": "Hoppscotch-SP",
|
207
|
-
* "description": "SP for hoppscotch.io",
|
208
|
-
* "clientID": "Xq8AJt3yYAxmXizsCWmUBDRiVP1iTC8Y/otnvFIMitk",
|
209
|
-
* "clientSecret": "00e3e11a3426f97d8000000738300009130cd45419c5943",
|
210
|
-
* "certs": {
|
211
|
-
* "publicKey": "-----BEGIN CERTIFICATE-----.......-----END CERTIFICATE-----",
|
212
|
-
* "privateKey": "-----BEGIN PRIVATE KEY-----......-----END PRIVATE KEY-----"
|
213
|
-
* }
|
214
|
-
* }
|
215
|
-
* }
|
216
|
-
* '400':
|
217
|
-
* description: Please provide `clientID` or `tenant` and `product`.
|
103
|
+
* type: accounts.google.com
|
218
104
|
* '401':
|
219
105
|
* description: Unauthorized
|
220
106
|
*/
|
@@ -222,7 +108,7 @@ export declare class APIController implements IAPIController {
|
|
222
108
|
clientID: string;
|
223
109
|
tenant: string;
|
224
110
|
product: string;
|
225
|
-
}): Promise<
|
111
|
+
}): Promise<Partial<OAuth>>;
|
226
112
|
/**
|
227
113
|
* @swagger
|
228
114
|
* /api/v1/saml/config:
|
@@ -257,8 +143,6 @@ export declare class APIController implements IAPIController {
|
|
257
143
|
* responses:
|
258
144
|
* '200':
|
259
145
|
* description: Success
|
260
|
-
* '400':
|
261
|
-
* description: clientSecret mismatch | Please provide `clientID` and `clientSecret` or `tenant` and `product`.'
|
262
146
|
* '401':
|
263
147
|
* description: Unauthorized
|
264
148
|
*/
|
package/dist/controller/api.js
CHANGED
@@ -27,17 +27,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
27
27
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
28
28
|
});
|
29
29
|
};
|
30
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
31
|
-
var t = {};
|
32
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
33
|
-
t[p] = s[p];
|
34
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
35
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
36
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
37
|
-
t[p[i]] = s[p[i]];
|
38
|
-
}
|
39
|
-
return t;
|
40
|
-
};
|
41
30
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
42
31
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
43
32
|
};
|
@@ -55,7 +44,7 @@ class APIController {
|
|
55
44
|
this.configStore = configStore;
|
56
45
|
}
|
57
46
|
_validateIdPConfig(body) {
|
58
|
-
const { encodedRawMetadata, rawMetadata, defaultRedirectUrl, redirectUrl, tenant, product
|
47
|
+
const { encodedRawMetadata, rawMetadata, defaultRedirectUrl, redirectUrl, tenant, product } = body;
|
59
48
|
if (!rawMetadata && !encodedRawMetadata) {
|
60
49
|
throw new error_1.JacksonError('Please provide rawMetadata or encodedRawMetadata', 400);
|
61
50
|
}
|
@@ -71,12 +60,6 @@ class APIController {
|
|
71
60
|
if (!product) {
|
72
61
|
throw new error_1.JacksonError('Please provide product', 400);
|
73
62
|
}
|
74
|
-
if (!name) {
|
75
|
-
throw new error_1.JacksonError('Please provide a friendly name', 400);
|
76
|
-
}
|
77
|
-
if (description && description.length > 100) {
|
78
|
-
throw new error_1.JacksonError('Description should not exceed 100 characters', 400);
|
79
|
-
}
|
80
63
|
}
|
81
64
|
/**
|
82
65
|
* @swagger
|
@@ -91,24 +74,10 @@ class APIController {
|
|
91
74
|
* consumes:
|
92
75
|
* - application/x-www-form-urlencoded
|
93
76
|
* parameters:
|
94
|
-
* - name: name
|
95
|
-
* description: Name/identifier for the config
|
96
|
-
* type: string
|
97
|
-
* in: formData
|
98
|
-
* required: true
|
99
|
-
* example: cal-saml-config
|
100
|
-
* - name: description
|
101
|
-
* description: A short description for the config not more than 100 characters
|
102
|
-
* type: string
|
103
|
-
* in: formData
|
104
|
-
* example: SAML login for cal.com app
|
105
77
|
* - name: encodedRawMetadata
|
106
78
|
* description: Base64 encoding of the XML metadata
|
107
79
|
* in: formData
|
108
|
-
*
|
109
|
-
* - name: rawMetadata
|
110
|
-
* description: Raw XML metadata
|
111
|
-
* in: formData
|
80
|
+
* required: true
|
112
81
|
* type: string
|
113
82
|
* - name: defaultRedirectUrl
|
114
83
|
* description: The redirect URL to use in the IdP login flow
|
@@ -150,14 +119,12 @@ class APIController {
|
|
150
119
|
* client_id: 8958e13053832b5af58fdf2ee83f35f5d013dc74
|
151
120
|
* client_secret: 13f01f4df5b01770c616e682d14d3ba23f20948cfa89b1d7
|
152
121
|
* type: accounts.google.com
|
153
|
-
* 400:
|
154
|
-
* description: Please provide rawMetadata or encodedRawMetadata | Please provide a defaultRedirectUrl | Please provide redirectUrl | Please provide tenant | Please provide product | Please provide a friendly name | Description should not exceed 100 characters
|
155
122
|
* 401:
|
156
123
|
* description: Unauthorized
|
157
124
|
*/
|
158
125
|
config(body) {
|
159
126
|
return __awaiter(this, void 0, void 0, function* () {
|
160
|
-
const { encodedRawMetadata, rawMetadata, defaultRedirectUrl, redirectUrl, tenant, product
|
127
|
+
const { encodedRawMetadata, rawMetadata, defaultRedirectUrl, redirectUrl, tenant, product } = body;
|
161
128
|
metrics.increment('createConfig');
|
162
129
|
this._validateIdPConfig(body);
|
163
130
|
let metaData = rawMetadata;
|
@@ -190,8 +157,6 @@ class APIController {
|
|
190
157
|
redirectUrl: JSON.parse(redirectUrl),
|
191
158
|
tenant,
|
192
159
|
product,
|
193
|
-
name,
|
194
|
-
description,
|
195
160
|
clientID,
|
196
161
|
clientSecret,
|
197
162
|
certs,
|
@@ -211,130 +176,6 @@ class APIController {
|
|
211
176
|
};
|
212
177
|
});
|
213
178
|
}
|
214
|
-
/**
|
215
|
-
* @swagger
|
216
|
-
*
|
217
|
-
* /api/v1/saml/config:
|
218
|
-
* patch:
|
219
|
-
* summary: Update SAML configuration
|
220
|
-
* operationId: update-saml-config
|
221
|
-
* tags: [SAML Config]
|
222
|
-
* consumes:
|
223
|
-
* - application/json
|
224
|
-
* - application/x-www-form-urlencoded
|
225
|
-
* parameters:
|
226
|
-
* - name: clientID
|
227
|
-
* description: Client ID for the config
|
228
|
-
* type: string
|
229
|
-
* in: formData
|
230
|
-
* required: true
|
231
|
-
* - name: clientSecret
|
232
|
-
* description: Client Secret for the config
|
233
|
-
* type: string
|
234
|
-
* in: formData
|
235
|
-
* required: true
|
236
|
-
* - name: name
|
237
|
-
* description: Name/identifier for the config
|
238
|
-
* type: string
|
239
|
-
* in: formData
|
240
|
-
* required: true
|
241
|
-
* example: cal-saml-config
|
242
|
-
* - name: description
|
243
|
-
* description: A short description for the config not more than 100 characters
|
244
|
-
* type: string
|
245
|
-
* in: formData
|
246
|
-
* example: SAML login for cal.com app
|
247
|
-
* - name: encodedRawMetadata
|
248
|
-
* description: Base64 encoding of the XML metadata
|
249
|
-
* in: formData
|
250
|
-
* type: string
|
251
|
-
* - name: rawMetadata
|
252
|
-
* description: Raw XML metadata
|
253
|
-
* in: formData
|
254
|
-
* type: string
|
255
|
-
* - name: defaultRedirectUrl
|
256
|
-
* description: The redirect URL to use in the IdP login flow
|
257
|
-
* in: formData
|
258
|
-
* required: true
|
259
|
-
* type: string
|
260
|
-
* example: http://localhost:3000/login/saml
|
261
|
-
* - name: redirectUrl
|
262
|
-
* description: JSON encoded array containing a list of allowed redirect URLs
|
263
|
-
* in: formData
|
264
|
-
* required: true
|
265
|
-
* type: string
|
266
|
-
* example: '["http://localhost:3000/*"]'
|
267
|
-
* - name: tenant
|
268
|
-
* description: Tenant
|
269
|
-
* in: formData
|
270
|
-
* required: true
|
271
|
-
* type: string
|
272
|
-
* example: boxyhq.com
|
273
|
-
* - name: product
|
274
|
-
* description: Product
|
275
|
-
* in: formData
|
276
|
-
* required: true
|
277
|
-
* type: string
|
278
|
-
* example: demo
|
279
|
-
* responses:
|
280
|
-
* 204:
|
281
|
-
* description: Success
|
282
|
-
* 400:
|
283
|
-
* description: Please provide clientID | Please provide clientSecret | clientSecret mismatch | Tenant/Product config mismatch with IdP metadata | Description should not exceed 100 characters
|
284
|
-
* 401:
|
285
|
-
* description: Unauthorized
|
286
|
-
*/
|
287
|
-
updateConfig(body) {
|
288
|
-
var _a;
|
289
|
-
return __awaiter(this, void 0, void 0, function* () {
|
290
|
-
const { encodedRawMetadata, // could be empty
|
291
|
-
rawMetadata, // could be empty
|
292
|
-
defaultRedirectUrl, redirectUrl, name, description } = body, clientInfo = __rest(body, ["encodedRawMetadata", "rawMetadata", "defaultRedirectUrl", "redirectUrl", "name", "description"]);
|
293
|
-
if (!(clientInfo === null || clientInfo === void 0 ? void 0 : clientInfo.clientID)) {
|
294
|
-
throw new error_1.JacksonError('Please provide clientID', 400);
|
295
|
-
}
|
296
|
-
if (!(clientInfo === null || clientInfo === void 0 ? void 0 : clientInfo.clientSecret)) {
|
297
|
-
throw new error_1.JacksonError('Please provide clientSecret', 400);
|
298
|
-
}
|
299
|
-
if (description && description.length > 100) {
|
300
|
-
throw new error_1.JacksonError('Description should not exceed 100 characters', 400);
|
301
|
-
}
|
302
|
-
const _currentConfig = (_a = (yield this.getConfig(clientInfo))) === null || _a === void 0 ? void 0 : _a.config;
|
303
|
-
if (_currentConfig.clientSecret !== (clientInfo === null || clientInfo === void 0 ? void 0 : clientInfo.clientSecret)) {
|
304
|
-
throw new error_1.JacksonError('clientSecret mismatch', 400);
|
305
|
-
}
|
306
|
-
let metaData = rawMetadata;
|
307
|
-
if (encodedRawMetadata) {
|
308
|
-
metaData = Buffer.from(encodedRawMetadata, 'base64').toString();
|
309
|
-
}
|
310
|
-
let newMetadata;
|
311
|
-
if (metaData) {
|
312
|
-
newMetadata = yield saml_1.default.parseMetadataAsync(metaData);
|
313
|
-
// extract provider
|
314
|
-
let providerName = extractHostName(newMetadata.entityID);
|
315
|
-
if (!providerName) {
|
316
|
-
providerName = extractHostName(newMetadata.sso.redirectUrl || newMetadata.sso.postUrl);
|
317
|
-
}
|
318
|
-
newMetadata.provider = providerName ? providerName : 'Unknown';
|
319
|
-
}
|
320
|
-
if (newMetadata) {
|
321
|
-
// check if clientID matches with new metadata payload
|
322
|
-
const clientID = dbutils.keyDigest(dbutils.keyFromParts(clientInfo.tenant, clientInfo.product, newMetadata.entityID));
|
323
|
-
if (clientID !== (clientInfo === null || clientInfo === void 0 ? void 0 : clientInfo.clientID)) {
|
324
|
-
throw new error_1.JacksonError('Tenant/Product config mismatch with IdP metadata', 400);
|
325
|
-
}
|
326
|
-
}
|
327
|
-
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 }), {
|
328
|
-
// secondary index on entityID
|
329
|
-
name: utils_1.IndexNames.EntityID,
|
330
|
-
value: _currentConfig.idpMetadata.entityID,
|
331
|
-
}, {
|
332
|
-
// secondary index on tenant + product
|
333
|
-
name: utils_1.IndexNames.TenantProduct,
|
334
|
-
value: dbutils.keyFromParts(_currentConfig.tenant, _currentConfig.product),
|
335
|
-
});
|
336
|
-
});
|
337
|
-
}
|
338
179
|
/**
|
339
180
|
* @swagger
|
340
181
|
*
|
@@ -364,35 +205,11 @@ class APIController {
|
|
364
205
|
* description: Success
|
365
206
|
* schema:
|
366
207
|
* type: object
|
208
|
+
* properties:
|
209
|
+
* provider:
|
210
|
+
* type: string
|
367
211
|
* example:
|
368
|
-
*
|
369
|
-
* "config": {
|
370
|
-
* "idpMetadata": {
|
371
|
-
* "sso": {
|
372
|
-
* "postUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxxx/sso/saml",
|
373
|
-
* "redirectUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxxx/sso/saml"
|
374
|
-
* },
|
375
|
-
* "entityID": "http://www.okta.com/xxxxxxxxxxxxx",
|
376
|
-
* "thumbprint": "Eo+eUi3UM3XIMkFFtdVK3yJ5vO9f7YZdasdasdad",
|
377
|
-
* "loginType": "idp",
|
378
|
-
* "provider": "okta.com"
|
379
|
-
* },
|
380
|
-
* "defaultRedirectUrl": "https://hoppscotch.io/",
|
381
|
-
* "redirectUrl": ["https://hoppscotch.io/"],
|
382
|
-
* "tenant": "hoppscotch.io",
|
383
|
-
* "product": "API Engine",
|
384
|
-
* "name": "Hoppscotch-SP",
|
385
|
-
* "description": "SP for hoppscotch.io",
|
386
|
-
* "clientID": "Xq8AJt3yYAxmXizsCWmUBDRiVP1iTC8Y/otnvFIMitk",
|
387
|
-
* "clientSecret": "00e3e11a3426f97d8000000738300009130cd45419c5943",
|
388
|
-
* "certs": {
|
389
|
-
* "publicKey": "-----BEGIN CERTIFICATE-----.......-----END CERTIFICATE-----",
|
390
|
-
* "privateKey": "-----BEGIN PRIVATE KEY-----......-----END PRIVATE KEY-----"
|
391
|
-
* }
|
392
|
-
* }
|
393
|
-
* }
|
394
|
-
* '400':
|
395
|
-
* description: Please provide `clientID` or `tenant` and `product`.
|
212
|
+
* type: accounts.google.com
|
396
213
|
* '401':
|
397
214
|
* description: Unauthorized
|
398
215
|
*/
|
@@ -402,7 +219,7 @@ class APIController {
|
|
402
219
|
metrics.increment('getConfig');
|
403
220
|
if (clientID) {
|
404
221
|
const samlConfig = yield this.configStore.get(clientID);
|
405
|
-
return samlConfig ? {
|
222
|
+
return samlConfig ? { provider: samlConfig.idpMetadata.provider } : {};
|
406
223
|
}
|
407
224
|
if (tenant && product) {
|
408
225
|
const samlConfigs = yield this.configStore.getByIndex({
|
@@ -412,7 +229,7 @@ class APIController {
|
|
412
229
|
if (!samlConfigs || !samlConfigs.length) {
|
413
230
|
return {};
|
414
231
|
}
|
415
|
-
return {
|
232
|
+
return { provider: samlConfigs[0].idpMetadata.provider };
|
416
233
|
}
|
417
234
|
throw new error_1.JacksonError('Please provide `clientID` or `tenant` and `product`.', 400);
|
418
235
|
});
|
@@ -451,8 +268,6 @@ class APIController {
|
|
451
268
|
* responses:
|
452
269
|
* '200':
|
453
270
|
* description: Success
|
454
|
-
* '400':
|
455
|
-
* description: clientSecret mismatch | Please provide `clientID` and `clientSecret` or `tenant` and `product`.'
|
456
271
|
* '401':
|
457
272
|
* description: Unauthorized
|
458
273
|
*/
|
@@ -469,7 +284,7 @@ class APIController {
|
|
469
284
|
yield this.configStore.delete(clientID);
|
470
285
|
}
|
471
286
|
else {
|
472
|
-
throw new error_1.JacksonError('clientSecret mismatch', 400);
|
287
|
+
throw new error_1.JacksonError('clientSecret mismatch.', 400);
|
473
288
|
}
|
474
289
|
return;
|
475
290
|
}
|
package/dist/controller/oauth.js
CHANGED
@@ -121,20 +121,7 @@ class OAuthController {
|
|
121
121
|
if (!allowed.redirect(redirect_uri, samlConfig.redirectUrl)) {
|
122
122
|
throw new error_1.JacksonError('Redirect URL is not allowed.', 403);
|
123
123
|
}
|
124
|
-
let ssoUrl;
|
125
|
-
let post = false;
|
126
|
-
const { sso } = samlConfig.idpMetadata;
|
127
|
-
if ('redirectUrl' in sso) {
|
128
|
-
// HTTP Redirect binding
|
129
|
-
ssoUrl = sso.redirectUrl;
|
130
|
-
}
|
131
|
-
else if ('postUrl' in sso) {
|
132
|
-
// HTTP-POST binding
|
133
|
-
ssoUrl = sso.postUrl;
|
134
|
-
post = true;
|
135
|
-
}
|
136
124
|
const samlReq = saml_1.default.request({
|
137
|
-
ssoUrl,
|
138
125
|
entityID: this.opts.samlAudience,
|
139
126
|
callbackUrl: this.opts.externalUrl + this.opts.samlPath,
|
140
127
|
signingKey: samlConfig.certs.privateKey,
|
@@ -148,24 +135,13 @@ class OAuthController {
|
|
148
135
|
code_challenge,
|
149
136
|
code_challenge_method,
|
150
137
|
});
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
SAMLRequest: Buffer.from(yield deflateRawAsync(samlReq.request)).toString('base64'),
|
159
|
-
});
|
160
|
-
}
|
161
|
-
else {
|
162
|
-
// HTTP POST binding
|
163
|
-
authorizeForm = (0, utils_1.createAuthorizeForm)(relayState, encodeURI(Buffer.from(samlReq.request).toString('base64')), ssoUrl);
|
164
|
-
}
|
165
|
-
return {
|
166
|
-
redirect_url: redirectUrl,
|
167
|
-
authorize_form: authorizeForm,
|
168
|
-
};
|
138
|
+
// deepak: When supporting HTTP-POST skip deflate
|
139
|
+
const samlReqEnc = yield deflateRawAsync(samlReq.request);
|
140
|
+
const redirectUrl = redirect.success(samlConfig.idpMetadata.sso.redirectUrl, {
|
141
|
+
RelayState: relayStatePrefix + sessionId,
|
142
|
+
SAMLRequest: Buffer.from(samlReqEnc).toString('base64'),
|
143
|
+
});
|
144
|
+
return { redirect_url: redirectUrl };
|
169
145
|
});
|
170
146
|
}
|
171
147
|
samlResponse(body) {
|
package/dist/controller/utils.js
CHANGED
@@ -1,32 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.IndexNames = void 0;
|
4
4
|
var IndexNames;
|
5
5
|
(function (IndexNames) {
|
6
6
|
IndexNames["EntityID"] = "entityID";
|
7
7
|
IndexNames["TenantProduct"] = "tenantProduct";
|
8
8
|
})(IndexNames = exports.IndexNames || (exports.IndexNames = {}));
|
9
|
-
const createAuthorizeForm = (relayState, samlReqEnc, postUrl) => {
|
10
|
-
const formElements = [
|
11
|
-
'<!DOCTYPE html>',
|
12
|
-
'<html>',
|
13
|
-
'<head>',
|
14
|
-
'<meta charset="utf-8">',
|
15
|
-
'<meta http-equiv="x-ua-compatible" content="ie=edge">',
|
16
|
-
'</head>',
|
17
|
-
'<body onload="document.forms[0].submit()">',
|
18
|
-
'<noscript>',
|
19
|
-
'<p>Note: Since your browser does not support JavaScript, you must press the Continue button once to proceed.</p>',
|
20
|
-
'</noscript>',
|
21
|
-
'<form method="post" action="' + encodeURI(postUrl) + '">',
|
22
|
-
'<input type="hidden" name="RelayState" value="' + relayState + '"/>',
|
23
|
-
'<input type="hidden" name="SAMLRequest" value="' + samlReqEnc + '"/>',
|
24
|
-
'<input type="submit" value="Continue" />',
|
25
|
-
'</form>',
|
26
|
-
'<script>document.forms[0].style.display="none";</script>',
|
27
|
-
'</body>',
|
28
|
-
'</html>',
|
29
|
-
];
|
30
|
-
return formElements.join('');
|
31
|
-
};
|
32
|
-
exports.createAuthorizeForm = createAuthorizeForm;
|
package/dist/db/db.d.ts
CHANGED
@@ -4,7 +4,6 @@ declare class DB implements DatabaseDriver {
|
|
4
4
|
private encryptionKey;
|
5
5
|
constructor(db: DatabaseDriver, encryptionKey: EncryptionKey);
|
6
6
|
get(namespace: string, key: string): Promise<unknown>;
|
7
|
-
getAll(namespace: any): Promise<unknown[]>;
|
8
7
|
getByIndex(namespace: string, idx: Index): Promise<unknown[]>;
|
9
8
|
put(namespace: string, key: string, val: unknown, ttl?: number, ...indexes: Index[]): Promise<unknown>;
|
10
9
|
delete(namespace: string, key: string): Promise<unknown>;
|
package/dist/db/db.js
CHANGED
@@ -57,15 +57,6 @@ class DB {
|
|
57
57
|
return decrypt(res, this.encryptionKey);
|
58
58
|
});
|
59
59
|
}
|
60
|
-
getAll(namespace) {
|
61
|
-
return __awaiter(this, void 0, void 0, function* () {
|
62
|
-
const res = (yield this.db.getAll(namespace));
|
63
|
-
const encryptionKey = this.encryptionKey;
|
64
|
-
return res.map((r) => {
|
65
|
-
return decrypt(r, encryptionKey);
|
66
|
-
});
|
67
|
-
});
|
68
|
-
}
|
69
60
|
getByIndex(namespace, idx) {
|
70
61
|
return __awaiter(this, void 0, void 0, function* () {
|
71
62
|
const res = yield this.db.getByIndex(namespace, idx);
|
package/dist/db/mem.d.ts
CHANGED
@@ -10,7 +10,6 @@ declare class Mem implements DatabaseDriver {
|
|
10
10
|
constructor(options: DatabaseOption);
|
11
11
|
init(): Promise<Mem>;
|
12
12
|
get(namespace: string, key: string): Promise<any>;
|
13
|
-
getAll(namespace: string): Promise<unknown[]>;
|
14
13
|
getByIndex(namespace: string, idx: Index): Promise<any>;
|
15
14
|
put(namespace: string, key: string, val: Encrypted, ttl?: number, ...indexes: any[]): Promise<any>;
|
16
15
|
delete(namespace: string, key: string): Promise<any>;
|
package/dist/db/mem.js
CHANGED
@@ -66,21 +66,6 @@ class Mem {
|
|
66
66
|
return null;
|
67
67
|
});
|
68
68
|
}
|
69
|
-
getAll(namespace) {
|
70
|
-
return __awaiter(this, void 0, void 0, function* () {
|
71
|
-
const returnValue = [];
|
72
|
-
if (namespace) {
|
73
|
-
for (const key in this.store) {
|
74
|
-
if (key.startsWith(namespace)) {
|
75
|
-
returnValue.push(this.store[key]);
|
76
|
-
}
|
77
|
-
}
|
78
|
-
}
|
79
|
-
if (returnValue)
|
80
|
-
return returnValue;
|
81
|
-
return [];
|
82
|
-
});
|
83
|
-
}
|
84
69
|
getByIndex(namespace, idx) {
|
85
70
|
return __awaiter(this, void 0, void 0, function* () {
|
86
71
|
const dbKeys = yield this.indexes[dbutils.keyForIndex(namespace, idx)];
|
@@ -95,10 +80,6 @@ class Mem {
|
|
95
80
|
return __awaiter(this, void 0, void 0, function* () {
|
96
81
|
const k = dbutils.key(namespace, key);
|
97
82
|
this.store[k] = val;
|
98
|
-
if (!Date.parse(this.store['createdAt']))
|
99
|
-
this.store['createdAt'] = new Date().toISOString();
|
100
|
-
this.store['modifiedAt'] = new Date().toISOString();
|
101
|
-
// console.log(this.store)
|
102
83
|
if (ttl) {
|
103
84
|
this.ttlStore[k] = {
|
104
85
|
namespace,
|
package/dist/db/mongo.d.ts
CHANGED
@@ -7,7 +7,6 @@ declare class Mongo implements DatabaseDriver {
|
|
7
7
|
constructor(options: DatabaseOption);
|
8
8
|
init(): Promise<Mongo>;
|
9
9
|
get(namespace: string, key: string): Promise<any>;
|
10
|
-
getAll(namespace: string): Promise<unknown[]>;
|
11
10
|
getByIndex(namespace: string, idx: Index): Promise<any>;
|
12
11
|
put(namespace: string, key: string, val: Encrypted, ttl?: number, ...indexes: any[]): Promise<void>;
|
13
12
|
delete(namespace: string, key: string): Promise<any>;
|
package/dist/db/mongo.js
CHANGED
@@ -36,16 +36,8 @@ class Mongo {
|
|
36
36
|
}
|
37
37
|
init() {
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
39
|
-
|
40
|
-
|
41
|
-
throw Error('Please specify a db url');
|
42
|
-
}
|
43
|
-
this.client = new mongodb_1.MongoClient(this.options.url);
|
44
|
-
yield this.client.connect();
|
45
|
-
}
|
46
|
-
catch (err) {
|
47
|
-
console.error(`error connecting to ${this.options.type} db: ${err}`);
|
48
|
-
}
|
39
|
+
this.client = new mongodb_1.MongoClient(this.options.url);
|
40
|
+
yield this.client.connect();
|
49
41
|
this.db = this.client.db();
|
50
42
|
this.collection = this.db.collection('jacksonStore');
|
51
43
|
yield this.collection.createIndex({ indexes: 1 });
|
@@ -64,15 +56,6 @@ class Mongo {
|
|
64
56
|
return null;
|
65
57
|
});
|
66
58
|
}
|
67
|
-
getAll(namespace) {
|
68
|
-
return __awaiter(this, void 0, void 0, function* () {
|
69
|
-
const _namespaceMatch = new RegExp(`^${namespace}:.*`);
|
70
|
-
const docs = yield this.collection.find({ _id: _namespaceMatch }).toArray();
|
71
|
-
if (docs)
|
72
|
-
return docs.map(({ value }) => value);
|
73
|
-
return [];
|
74
|
-
});
|
75
|
-
}
|
76
59
|
getByIndex(namespace, idx) {
|
77
60
|
return __awaiter(this, void 0, void 0, function* () {
|
78
61
|
const docs = yield this.collection
|
@@ -103,12 +86,8 @@ class Mongo {
|
|
103
86
|
}
|
104
87
|
doc.indexes.push(idxKey);
|
105
88
|
}
|
106
|
-
doc.modifiedAt = new Date().toISOString();
|
107
89
|
yield this.collection.updateOne({ _id: dbutils.key(namespace, key) }, {
|
108
90
|
$set: doc,
|
109
|
-
$setOnInsert: {
|
110
|
-
createdAt: new Date().toISOString(),
|
111
|
-
},
|
112
91
|
}, { upsert: true });
|
113
92
|
});
|
114
93
|
}
|
package/dist/db/redis.d.ts
CHANGED
@@ -5,7 +5,6 @@ declare class Redis implements DatabaseDriver {
|
|
5
5
|
constructor(options: DatabaseOption);
|
6
6
|
init(): Promise<Redis>;
|
7
7
|
get(namespace: string, key: string): Promise<any>;
|
8
|
-
getAll(namespace: string): Promise<unknown[]>;
|
9
8
|
getByIndex(namespace: string, idx: Index): Promise<any>;
|
10
9
|
put(namespace: string, key: string, val: Encrypted, ttl?: number, ...indexes: any[]): Promise<void>;
|
11
10
|
delete(namespace: string, key: string): Promise<any>;
|
package/dist/db/redis.js
CHANGED
@@ -57,26 +57,6 @@ class Redis {
|
|
57
57
|
return null;
|
58
58
|
});
|
59
59
|
}
|
60
|
-
getAll(namespace) {
|
61
|
-
return __awaiter(this, void 0, void 0, function* () {
|
62
|
-
const keys = yield this.client.sendCommand(['keys', namespace + ':*']);
|
63
|
-
const returnValue = [];
|
64
|
-
for (let i = 0; i < keys.length; i++) {
|
65
|
-
try {
|
66
|
-
if (this.client.get(keys[i])) {
|
67
|
-
const value = yield this.client.get(keys[i]);
|
68
|
-
returnValue.push(JSON.parse(value));
|
69
|
-
}
|
70
|
-
}
|
71
|
-
catch (error) {
|
72
|
-
console.error(error);
|
73
|
-
}
|
74
|
-
}
|
75
|
-
if (returnValue)
|
76
|
-
return returnValue;
|
77
|
-
return [];
|
78
|
-
});
|
79
|
-
}
|
80
60
|
getByIndex(namespace, idx) {
|
81
61
|
return __awaiter(this, void 0, void 0, function* () {
|
82
62
|
const dbKeys = yield this.client.sMembers(dbutils.keyForIndex(namespace, idx));
|
@@ -36,19 +36,6 @@ __decorate([
|
|
36
36
|
nullable: true,
|
37
37
|
})
|
38
38
|
], JacksonStore.prototype, "tag", void 0);
|
39
|
-
__decorate([
|
40
|
-
(0, typeorm_1.Column)({
|
41
|
-
type: 'timestamp',
|
42
|
-
default: () => 'CURRENT_TIMESTAMP',
|
43
|
-
nullable: false,
|
44
|
-
})
|
45
|
-
], JacksonStore.prototype, "createdAt", void 0);
|
46
|
-
__decorate([
|
47
|
-
(0, typeorm_1.Column)({
|
48
|
-
type: 'timestamp',
|
49
|
-
nullable: true,
|
50
|
-
})
|
51
|
-
], JacksonStore.prototype, "modifiedAt", void 0);
|
52
39
|
JacksonStore = __decorate([
|
53
40
|
(0, typeorm_1.Entity)()
|
54
41
|
], JacksonStore);
|
package/dist/db/sql/sql.d.ts
CHANGED
@@ -10,7 +10,6 @@ declare class Sql implements DatabaseDriver {
|
|
10
10
|
constructor(options: DatabaseOption);
|
11
11
|
init(): Promise<Sql>;
|
12
12
|
get(namespace: string, key: string): Promise<any>;
|
13
|
-
getAll(namespace: string): Promise<unknown[]>;
|
14
13
|
getByIndex(namespace: string, idx: Index): Promise<any>;
|
15
14
|
put(namespace: string, key: string, val: Encrypted, ttl?: number, ...indexes: any[]): Promise<void>;
|
16
15
|
delete(namespace: string, key: string): Promise<any>;
|
package/dist/db/sql/sql.js
CHANGED
@@ -95,7 +95,7 @@ class Sql {
|
|
95
95
|
}
|
96
96
|
get(namespace, key) {
|
97
97
|
return __awaiter(this, void 0, void 0, function* () {
|
98
|
-
|
98
|
+
let res = yield this.storeRepository.findOne({
|
99
99
|
key: dbutils.key(namespace, key),
|
100
100
|
});
|
101
101
|
if (res && res.value) {
|
@@ -108,22 +108,6 @@ class Sql {
|
|
108
108
|
return null;
|
109
109
|
});
|
110
110
|
}
|
111
|
-
getAll(namespace) {
|
112
|
-
return __awaiter(this, void 0, void 0, function* () {
|
113
|
-
const response = yield this.storeRepository.find({
|
114
|
-
where: { key: (0, typeorm_1.Like)(`%${namespace}%`) },
|
115
|
-
select: ['value', 'iv', 'tag'],
|
116
|
-
order: {
|
117
|
-
['createdAt']: 'DESC',
|
118
|
-
// ['createdAt']: 'ASC',
|
119
|
-
},
|
120
|
-
});
|
121
|
-
const returnValue = JSON.parse(JSON.stringify(response));
|
122
|
-
if (returnValue)
|
123
|
-
return returnValue;
|
124
|
-
return [];
|
125
|
-
});
|
126
|
-
}
|
127
111
|
getByIndex(namespace, idx) {
|
128
112
|
return __awaiter(this, void 0, void 0, function* () {
|
129
113
|
const res = yield this.indexRepository.find({
|
@@ -151,7 +135,6 @@ class Sql {
|
|
151
135
|
store.value = val.value;
|
152
136
|
store.iv = val.iv;
|
153
137
|
store.tag = val.tag;
|
154
|
-
store.modifiedAt = new Date().toISOString();
|
155
138
|
yield transactionalEntityManager.save(store);
|
156
139
|
if (ttl) {
|
157
140
|
const ttlRec = new JacksonTTL_1.JacksonTTL();
|
package/dist/db/store.js
CHANGED
@@ -40,11 +40,6 @@ class Store {
|
|
40
40
|
return yield this.db.get(this.namespace, dbutils.keyDigest(key));
|
41
41
|
});
|
42
42
|
}
|
43
|
-
getAll() {
|
44
|
-
return __awaiter(this, void 0, void 0, function* () {
|
45
|
-
return yield this.db.getAll(this.namespace);
|
46
|
-
});
|
47
|
-
}
|
48
43
|
getByIndex(idx) {
|
49
44
|
return __awaiter(this, void 0, void 0, function* () {
|
50
45
|
idx.value = dbutils.keyDigest(idx.value);
|
package/dist/index.d.ts
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
import { APIController } from './controller/api';
|
2
2
|
import { OAuthController } from './controller/oauth';
|
3
|
-
import { AdminController } from './controller/admin';
|
4
3
|
import { JacksonOption } from './typings';
|
5
4
|
export declare const controllers: (opts: JacksonOption) => Promise<{
|
6
5
|
apiController: APIController;
|
7
6
|
oauthController: OAuthController;
|
8
|
-
adminController: AdminController;
|
9
7
|
}>;
|
10
8
|
export default controllers;
|
11
9
|
export * from './typings';
|
package/dist/index.js
CHANGED
@@ -25,7 +25,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.controllers = void 0;
|
26
26
|
const api_1 = require("./controller/api");
|
27
27
|
const oauth_1 = require("./controller/oauth");
|
28
|
-
const admin_1 = require("./controller/admin");
|
29
28
|
const db_1 = __importDefault(require("./db/db"));
|
30
29
|
const read_config_1 = __importDefault(require("./read-config"));
|
31
30
|
const defaultOpts = (opts) => {
|
@@ -56,7 +55,6 @@ const controllers = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
55
|
const codeStore = db.store('oauth:code', opts.db.ttl);
|
57
56
|
const tokenStore = db.store('oauth:token', opts.db.ttl);
|
58
57
|
const apiController = new api_1.APIController({ configStore });
|
59
|
-
const adminController = new admin_1.AdminController({ configStore });
|
60
58
|
const oauthController = new oauth_1.OAuthController({
|
61
59
|
configStore,
|
62
60
|
sessionStore,
|
@@ -77,7 +75,6 @@ const controllers = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
77
75
|
return {
|
78
76
|
apiController,
|
79
77
|
oauthController,
|
80
|
-
adminController,
|
81
78
|
};
|
82
79
|
});
|
83
80
|
exports.controllers = controllers;
|
package/dist/saml/saml.js
CHANGED
@@ -68,7 +68,7 @@ const request = ({ ssoUrl, entityID, callbackUrl, isPassive = false, forceAuthn
|
|
68
68
|
'@ID': id,
|
69
69
|
'@Version': '2.0',
|
70
70
|
'@IssueInstant': date,
|
71
|
-
'@ProtocolBinding': 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-
|
71
|
+
'@ProtocolBinding': 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
|
72
72
|
'@Destination': ssoUrl,
|
73
73
|
'saml:Issuer': {
|
74
74
|
'@xmlns:saml': 'urn:oasis:names:tc:SAML:2.0:assertion',
|
package/dist/typings.d.ts
CHANGED
@@ -3,8 +3,6 @@ export declare type IdPConfig = {
|
|
3
3
|
redirectUrl: string;
|
4
4
|
tenant: string;
|
5
5
|
product: string;
|
6
|
-
name: string;
|
7
|
-
description: string;
|
8
6
|
rawMetadata?: string;
|
9
7
|
encodedRawMetadata?: string;
|
10
8
|
};
|
@@ -15,12 +13,11 @@ export interface OAuth {
|
|
15
13
|
}
|
16
14
|
export interface IAPIController {
|
17
15
|
config(body: IdPConfig): Promise<OAuth>;
|
18
|
-
updateConfig(body: any): Promise<void>;
|
19
16
|
getConfig(body: {
|
20
17
|
clientID?: string;
|
21
18
|
tenant?: string;
|
22
19
|
product?: string;
|
23
|
-
}): Promise<
|
20
|
+
}): Promise<Partial<OAuth>>;
|
24
21
|
deleteConfig(body: {
|
25
22
|
clientID?: string;
|
26
23
|
clientSecret?: string;
|
@@ -30,8 +27,7 @@ export interface IAPIController {
|
|
30
27
|
}
|
31
28
|
export interface IOAuthController {
|
32
29
|
authorize(body: OAuthReqBody): Promise<{
|
33
|
-
redirect_url
|
34
|
-
authorize_form?: string;
|
30
|
+
redirect_url: string;
|
35
31
|
}>;
|
36
32
|
samlResponse(body: SAMLResponsePayload): Promise<{
|
37
33
|
redirect_url: string;
|
@@ -39,9 +35,6 @@ export interface IOAuthController {
|
|
39
35
|
token(body: OAuthTokenReq): Promise<OAuthTokenRes>;
|
40
36
|
userInfo(token: string): Promise<Profile>;
|
41
37
|
}
|
42
|
-
export interface IAdminController {
|
43
|
-
getAllConfig(): any;
|
44
|
-
}
|
45
38
|
export interface OAuthReqBody {
|
46
39
|
response_type: 'code';
|
47
40
|
client_id: string;
|
@@ -80,14 +73,12 @@ export interface Index {
|
|
80
73
|
value: string;
|
81
74
|
}
|
82
75
|
export interface DatabaseDriver {
|
83
|
-
getAll(namespace: string): Promise<unknown[]>;
|
84
76
|
get(namespace: string, key: string): Promise<any>;
|
85
77
|
put(namespace: string, key: string, val: any, ttl: number, ...indexes: Index[]): Promise<any>;
|
86
78
|
delete(namespace: string, key: string): Promise<any>;
|
87
79
|
getByIndex(namespace: string, idx: Index): Promise<any>;
|
88
80
|
}
|
89
81
|
export interface Storable {
|
90
|
-
getAll(): Promise<unknown[]>;
|
91
82
|
get(key: string): Promise<any>;
|
92
83
|
put(key: string, val: any, ...indexes: Index[]): Promise<any>;
|
93
84
|
delete(key: string): Promise<any>;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@boxyhq/saml-jackson",
|
3
|
-
"version": "0.3.7-beta.
|
3
|
+
"version": "0.3.7-beta.746",
|
4
4
|
"description": "SAML 2.0 service",
|
5
5
|
"keywords": [
|
6
6
|
"SAML 2.0"
|
@@ -18,9 +18,9 @@
|
|
18
18
|
],
|
19
19
|
"scripts": {
|
20
20
|
"build": "tsc -p tsconfig.build.json",
|
21
|
-
"db:migration:generate:postgres": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:generate --config ormconfig.js -n
|
22
|
-
"db:migration:generate:mysql": "cross-env DB_TYPE=mysql DB_URL=mysql://root:mysql@localhost:3307/mysql ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:generate --config ormconfig.js -n
|
23
|
-
"db:migration:generate:mariadb": "cross-env DB_TYPE=mariadb DB_URL=mariadb://root@localhost:3306/mysql ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:generate --config ormconfig.js -n
|
21
|
+
"db:migration:generate:postgres": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:generate --config ormconfig.js -n Initial",
|
22
|
+
"db:migration:generate:mysql": "cross-env DB_TYPE=mysql DB_URL=mysql://root:mysql@localhost:3307/mysql ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:generate --config ormconfig.js -n Initial",
|
23
|
+
"db:migration:generate:mariadb": "cross-env DB_TYPE=mariadb DB_URL=mariadb://root@localhost:3306/mysql ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:generate --config ormconfig.js -n Initial",
|
24
24
|
"db:migration:run:postgres": "ts-node --transpile-only ./node_modules/typeorm/cli.js migration:run",
|
25
25
|
"db:migration:run:mysql": "cross-env DB_TYPE=mysql DB_URL=mysql://root:mysql@localhost:3307/mysql ts-node --transpile-only ./node_modules/typeorm/cli.js migration:run",
|
26
26
|
"db:migration:run:mariadb": "cross-env DB_TYPE=mariadb DB_URL=mariadb://root@localhost:3306/mysql ts-node --transpile-only ./node_modules/typeorm/cli.js migration:run",
|
@@ -40,6 +40,8 @@
|
|
40
40
|
"@opentelemetry/api-metrics": "0.27.0",
|
41
41
|
"@peculiar/webcrypto": "1.2.3",
|
42
42
|
"@peculiar/x509": "1.6.1",
|
43
|
+
"cors": "2.8.5",
|
44
|
+
"express": "4.17.2",
|
43
45
|
"mongodb": "4.3.1",
|
44
46
|
"mysql2": "2.3.3",
|
45
47
|
"pg": "8.7.3",
|
@@ -54,6 +56,7 @@
|
|
54
56
|
"xmlbuilder": "15.1.1"
|
55
57
|
},
|
56
58
|
"devDependencies": {
|
59
|
+
"@types/express": "4.17.13",
|
57
60
|
"@types/node": "17.0.17",
|
58
61
|
"@types/sinon": "10.0.11",
|
59
62
|
"@types/tap": "15.0.5",
|
package/dist/controller/admin.js
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.AdminController = void 0;
|
13
|
-
class AdminController {
|
14
|
-
constructor({ configStore }) {
|
15
|
-
this.configStore = configStore;
|
16
|
-
}
|
17
|
-
getAllConfig() {
|
18
|
-
return __awaiter(this, void 0, void 0, function* () {
|
19
|
-
const configList = (yield this.configStore.getAll());
|
20
|
-
if (!configList || !configList.length) {
|
21
|
-
return [];
|
22
|
-
}
|
23
|
-
return configList;
|
24
|
-
});
|
25
|
-
}
|
26
|
-
}
|
27
|
-
exports.AdminController = AdminController;
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import {MigrationInterface, QueryRunner} from "typeorm";
|
2
|
-
|
3
|
-
export class createdAt1644332636666 implements MigrationInterface {
|
4
|
-
name = 'createdAt1644332636666'
|
5
|
-
|
6
|
-
public async up(queryRunner: QueryRunner): Promise<void> {
|
7
|
-
await queryRunner.query(`ALTER TABLE \`jackson_store\` ADD \`createdAt\` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP()`);
|
8
|
-
await queryRunner.query(`ALTER TABLE \`jackson_store\` ADD \`modifiedAt\` timestamp NULL`);
|
9
|
-
}
|
10
|
-
|
11
|
-
public async down(queryRunner: QueryRunner): Promise<void> {
|
12
|
-
await queryRunner.query(`ALTER TABLE \`jackson_store\` DROP COLUMN \`modifiedAt\``);
|
13
|
-
await queryRunner.query(`ALTER TABLE \`jackson_store\` DROP COLUMN \`createdAt\``);
|
14
|
-
}
|
15
|
-
|
16
|
-
}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import {MigrationInterface, QueryRunner} from "typeorm";
|
2
|
-
|
3
|
-
export class createdAt1644332641078 implements MigrationInterface {
|
4
|
-
name = 'createdAt1644332641078'
|
5
|
-
|
6
|
-
public async up(queryRunner: QueryRunner): Promise<void> {
|
7
|
-
await queryRunner.query(`ALTER TABLE \`jackson_store\` ADD \`createdAt\` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP`);
|
8
|
-
await queryRunner.query(`ALTER TABLE \`jackson_store\` ADD \`modifiedAt\` timestamp NULL`);
|
9
|
-
}
|
10
|
-
|
11
|
-
public async down(queryRunner: QueryRunner): Promise<void> {
|
12
|
-
await queryRunner.query(`ALTER TABLE \`jackson_store\` DROP COLUMN \`modifiedAt\``);
|
13
|
-
await queryRunner.query(`ALTER TABLE \`jackson_store\` DROP COLUMN \`createdAt\``);
|
14
|
-
}
|
15
|
-
|
16
|
-
}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import {MigrationInterface, QueryRunner} from "typeorm";
|
2
|
-
|
3
|
-
export class createdAt1644332647279 implements MigrationInterface {
|
4
|
-
name = 'createdAt1644332647279'
|
5
|
-
|
6
|
-
public async up(queryRunner: QueryRunner): Promise<void> {
|
7
|
-
await queryRunner.query(`ALTER TABLE "jackson_store" ADD "createdAt" TIMESTAMP NOT NULL DEFAULT now()`);
|
8
|
-
await queryRunner.query(`ALTER TABLE "jackson_store" ADD "modifiedAt" TIMESTAMP`);
|
9
|
-
}
|
10
|
-
|
11
|
-
public async down(queryRunner: QueryRunner): Promise<void> {
|
12
|
-
await queryRunner.query(`ALTER TABLE "jackson_store" DROP COLUMN "modifiedAt"`);
|
13
|
-
await queryRunner.query(`ALTER TABLE "jackson_store" DROP COLUMN "createdAt"`);
|
14
|
-
}
|
15
|
-
|
16
|
-
}
|