@boxyhq/saml-jackson 1.11.1 → 1.11.2
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 +10 -136
- package/dist/controller/api.js +10 -136
- package/dist/controller/api.js.map +1 -1
- package/dist/controller/setup-link.d.ts +248 -4
- package/dist/controller/setup-link.js +297 -19
- package/dist/controller/setup-link.js.map +1 -1
- package/dist/controller/utils.d.ts +5 -4
- package/dist/controller/utils.js +5 -3
- package/dist/controller/utils.js.map +1 -1
- package/dist/directory-sync/scim/DirectoryConfig.d.ts +202 -0
- package/dist/directory-sync/scim/DirectoryConfig.js +202 -5
- package/dist/directory-sync/scim/DirectoryConfig.js.map +1 -1
- package/dist/directory-sync/scim/Groups.d.ts +60 -0
- package/dist/directory-sync/scim/Groups.js +60 -2
- package/dist/directory-sync/scim/Groups.js.map +1 -1
- package/dist/directory-sync/scim/Users.d.ts +69 -0
- package/dist/directory-sync/scim/Users.js +69 -2
- package/dist/directory-sync/scim/Users.js.map +1 -1
- package/package.json +13 -13
@@ -1,15 +1,259 @@
|
|
1
|
-
import { SetupLink, SetupLinkCreatePayload, Storable } from '../typings';
|
1
|
+
import { SetupLink, SetupLinkCreatePayload, Storable, PaginationParams, SetupLinkService } from '../typings';
|
2
|
+
interface FilterByParams extends PaginationParams {
|
3
|
+
service?: SetupLinkService;
|
4
|
+
tenant?: string;
|
5
|
+
product?: string;
|
6
|
+
}
|
7
|
+
export type RemoveSetupLinkParams = {
|
8
|
+
id: string;
|
9
|
+
} | {
|
10
|
+
service: SetupLinkService;
|
11
|
+
tenant: string;
|
12
|
+
product: string;
|
13
|
+
};
|
14
|
+
/**
|
15
|
+
* @swagger
|
16
|
+
* definitions:
|
17
|
+
* SetupLink:
|
18
|
+
* type: object
|
19
|
+
* properties:
|
20
|
+
* setupID:
|
21
|
+
* type: string
|
22
|
+
* description: Setup link ID
|
23
|
+
* tenant:
|
24
|
+
* type: string
|
25
|
+
* description: Tenant
|
26
|
+
* product:
|
27
|
+
* type: string
|
28
|
+
* description: Product
|
29
|
+
* validTill:
|
30
|
+
* type: string
|
31
|
+
* description: Valid till timestamp
|
32
|
+
* url:
|
33
|
+
* type: string
|
34
|
+
* description: Setup link URL
|
35
|
+
*/
|
2
36
|
export declare class SetupLinkController {
|
3
37
|
setupLinkStore: Storable;
|
4
38
|
constructor({ setupLinkStore }: {
|
5
39
|
setupLinkStore: any;
|
6
40
|
});
|
41
|
+
/**
|
42
|
+
* @swagger
|
43
|
+
* definitions:
|
44
|
+
* SetupLink:
|
45
|
+
* type: object
|
46
|
+
* example:
|
47
|
+
* {
|
48
|
+
* "data": {
|
49
|
+
* "setupID": "0689f76f7b5aa22f00381a124cb4b153fc1a8c08",
|
50
|
+
* "tenant": "acme",
|
51
|
+
* "product": "my-app",
|
52
|
+
* "service": "sso",
|
53
|
+
* "validTill": 1689849146690,
|
54
|
+
* "url": "http://localhost:5225/setup/0b96a483ebfe0af0b561dda35a96647074d944631ff9e070"
|
55
|
+
* }
|
56
|
+
* }
|
57
|
+
* parameters:
|
58
|
+
* tenantParamPost:
|
59
|
+
* name: tenant
|
60
|
+
* description: Tenant
|
61
|
+
* in: formData
|
62
|
+
* required: true
|
63
|
+
* type: string
|
64
|
+
* productParamPost:
|
65
|
+
* name: product
|
66
|
+
* description: Product
|
67
|
+
* in: formData
|
68
|
+
* required: true
|
69
|
+
* type: string
|
70
|
+
* defaultRedirectUrlParamPost:
|
71
|
+
* name: defaultRedirectUrl
|
72
|
+
* description: The redirect URL to use in the IdP login flow
|
73
|
+
* in: formData
|
74
|
+
* type: string
|
75
|
+
* required: true
|
76
|
+
* redirectUrlParamPost:
|
77
|
+
* name: redirectUrl
|
78
|
+
* description: JSON encoded array containing a list of allowed redirect URLs
|
79
|
+
* in: formData
|
80
|
+
* type: string
|
81
|
+
* required: true
|
82
|
+
* /api/v1/sso/setuplinks:
|
83
|
+
* post:
|
84
|
+
* summary: Create a Setup Link
|
85
|
+
* operationId: create-sso-setup-link
|
86
|
+
* tags: [Setup Links | Single Sign On]
|
87
|
+
* produces:
|
88
|
+
* - application/json
|
89
|
+
* consumes:
|
90
|
+
* - application/x-www-form-urlencoded
|
91
|
+
* - application/json
|
92
|
+
* parameters:
|
93
|
+
* - $ref: '#/parameters/tenantParamPost'
|
94
|
+
* - $ref: '#/parameters/productParamPost'
|
95
|
+
* - $ref: '#/parameters/defaultRedirectUrlParamPost'
|
96
|
+
* - $ref: '#/parameters/redirectUrlParamPost'
|
97
|
+
* responses:
|
98
|
+
* 200:
|
99
|
+
* description: Success
|
100
|
+
* schema:
|
101
|
+
* $ref: '#/definitions/SetupLink'
|
102
|
+
* /api/v1/dsync/setuplinks:
|
103
|
+
* post:
|
104
|
+
* summary: Create a Setup Link
|
105
|
+
* operationId: create-dsync-setup-link
|
106
|
+
* tags: [Setup Links | Directory Sync]
|
107
|
+
* produces:
|
108
|
+
* - application/json
|
109
|
+
* consumes:
|
110
|
+
* - application/x-www-form-urlencoded
|
111
|
+
* - application/json
|
112
|
+
* parameters:
|
113
|
+
* - $ref: '#/parameters/tenantParamPost'
|
114
|
+
* - $ref: '#/parameters/productParamPost'
|
115
|
+
* responses:
|
116
|
+
* 200:
|
117
|
+
* description: Success
|
118
|
+
* schema:
|
119
|
+
* $ref: '#/definitions/SetupLink'
|
120
|
+
*/
|
7
121
|
create(body: SetupLinkCreatePayload): Promise<SetupLink>;
|
8
122
|
getByToken(token: string): Promise<SetupLink>;
|
9
|
-
|
123
|
+
/**
|
124
|
+
* @swagger
|
125
|
+
* parameters:
|
126
|
+
* setupLinkId:
|
127
|
+
* name: id
|
128
|
+
* description: Setup link ID
|
129
|
+
* in: query
|
130
|
+
* required: false
|
131
|
+
* type: string
|
132
|
+
* /api/v1/sso/setuplinks:
|
133
|
+
* delete:
|
134
|
+
* summary: Delete the Setup Link
|
135
|
+
* parameters:
|
136
|
+
* - $ref: '#/parameters/tenantParamGet'
|
137
|
+
* - $ref: '#/parameters/productParamGet'
|
138
|
+
* - $ref: '#/parameters/setupLinkId'
|
139
|
+
* operationId: delete-sso-setup-link
|
140
|
+
* tags: [Setup Links | Single Sign On]
|
141
|
+
* responses:
|
142
|
+
* 200:
|
143
|
+
* description: Success
|
144
|
+
* schema:
|
145
|
+
* type: object
|
146
|
+
* example:
|
147
|
+
* {
|
148
|
+
* data: {}
|
149
|
+
* }
|
150
|
+
* /api/v1/dsync/setuplinks:
|
151
|
+
* delete:
|
152
|
+
* summary: Delete the Setup Link
|
153
|
+
* parameters:
|
154
|
+
* - $ref: '#/parameters/tenantParamGet'
|
155
|
+
* - $ref: '#/parameters/productParamGet'
|
156
|
+
* - $ref: '#/parameters/setupLinkId'
|
157
|
+
* operationId: delete-dsync-setup-link
|
158
|
+
* tags: [Setup Links | Directory Sync]
|
159
|
+
* responses:
|
160
|
+
* 200:
|
161
|
+
* description: Success
|
162
|
+
* schema:
|
163
|
+
* type: object
|
164
|
+
* example:
|
165
|
+
* {
|
166
|
+
* data: {}
|
167
|
+
* }
|
168
|
+
*/
|
169
|
+
remove(params: RemoveSetupLinkParams): Promise<void>;
|
170
|
+
isExpired(setupLink: SetupLink): boolean;
|
171
|
+
/**
|
172
|
+
* @swagger
|
173
|
+
* parameters:
|
174
|
+
* tenantParamGet:
|
175
|
+
* name: tenant
|
176
|
+
* description: Tenant
|
177
|
+
* in: query
|
178
|
+
* required: true
|
179
|
+
* type: string
|
180
|
+
* productParamGet:
|
181
|
+
* name: product
|
182
|
+
* description: Product
|
183
|
+
* in: query
|
184
|
+
* required: true
|
185
|
+
* type: string
|
186
|
+
* /api/v1/sso/setuplinks/product:
|
187
|
+
* get:
|
188
|
+
* summary: Get the Setup Links by product
|
189
|
+
* parameters:
|
190
|
+
* - $ref: '#/parameters/productParamGet'
|
191
|
+
* operationId: get-sso-setup-link-by-product
|
192
|
+
* tags: [Setup Links | Single Sign On]
|
193
|
+
* responses:
|
194
|
+
* 200:
|
195
|
+
* description: Success
|
196
|
+
* schema:
|
197
|
+
* type: array
|
198
|
+
* items:
|
199
|
+
* $ref: '#/definitions/SetupLink'
|
200
|
+
* /api/v1/dsync/setuplinks/product:
|
201
|
+
* get:
|
202
|
+
* summary: Get the Setup Links by product
|
203
|
+
* parameters:
|
204
|
+
* - $ref: '#/parameters/productParamGet'
|
205
|
+
* operationId: get-dsync-setup-link-by-product
|
206
|
+
* tags: [Setup Links | Directory Sync]
|
207
|
+
* responses:
|
208
|
+
* 200:
|
209
|
+
* description: Success
|
210
|
+
* schema:
|
211
|
+
* type: array
|
212
|
+
* items:
|
213
|
+
* $ref: '#/definitions/SetupLink'
|
214
|
+
*/
|
215
|
+
filterBy(params: FilterByParams): Promise<{
|
10
216
|
data: SetupLink[];
|
11
217
|
pageToken?: string;
|
12
218
|
}>;
|
13
|
-
|
14
|
-
|
219
|
+
/**
|
220
|
+
* @swagger
|
221
|
+
* parameters:
|
222
|
+
* idParamGet:
|
223
|
+
* name: id
|
224
|
+
* description: Setup Link ID
|
225
|
+
* in: query
|
226
|
+
* required: false
|
227
|
+
* type: string
|
228
|
+
* /api/v1/sso/setuplinks:
|
229
|
+
* get:
|
230
|
+
* summary: Get the Setup Link
|
231
|
+
* parameters:
|
232
|
+
* - $ref: '#/parameters/tenantParamGet'
|
233
|
+
* - $ref: '#/parameters/productParamGet'
|
234
|
+
* - $ref: '#/parameters/idParamGet'
|
235
|
+
* operationId: get-sso-setup-link
|
236
|
+
* tags: [Setup Links | Single Sign On]
|
237
|
+
* responses:
|
238
|
+
* 200:
|
239
|
+
* description: Success
|
240
|
+
* schema:
|
241
|
+
* $ref: '#/definitions/SetupLink'
|
242
|
+
* /api/v1/dsync/setuplinks:
|
243
|
+
* get:
|
244
|
+
* summary: Get the Setup Link
|
245
|
+
* parameters:
|
246
|
+
* - $ref: '#/parameters/tenantParamGet'
|
247
|
+
* - $ref: '#/parameters/productParamGet'
|
248
|
+
* - $ref: '#/parameters/idParamGet'
|
249
|
+
* operationId: get-dsync-setup-link
|
250
|
+
* tags: [Setup Links | Directory Sync]
|
251
|
+
* responses:
|
252
|
+
* 200:
|
253
|
+
* description: Success
|
254
|
+
* schema:
|
255
|
+
* $ref: '#/definitions/SetupLink'
|
256
|
+
*/
|
257
|
+
get(id: string): Promise<SetupLink>;
|
15
258
|
}
|
259
|
+
export {};
|
@@ -40,11 +40,117 @@ const dbutils = __importStar(require("../db/utils"));
|
|
40
40
|
const utils_1 = require("./utils");
|
41
41
|
const crypto_1 = __importDefault(require("crypto"));
|
42
42
|
const error_1 = require("./error");
|
43
|
+
const throwIfInvalidService = (service) => {
|
44
|
+
if (!['sso', 'dsync'].includes(service)) {
|
45
|
+
throw new error_1.JacksonError('Invalid service provided. Supported values are: sso, dsync', 400);
|
46
|
+
}
|
47
|
+
};
|
48
|
+
/**
|
49
|
+
* @swagger
|
50
|
+
* definitions:
|
51
|
+
* SetupLink:
|
52
|
+
* type: object
|
53
|
+
* properties:
|
54
|
+
* setupID:
|
55
|
+
* type: string
|
56
|
+
* description: Setup link ID
|
57
|
+
* tenant:
|
58
|
+
* type: string
|
59
|
+
* description: Tenant
|
60
|
+
* product:
|
61
|
+
* type: string
|
62
|
+
* description: Product
|
63
|
+
* validTill:
|
64
|
+
* type: string
|
65
|
+
* description: Valid till timestamp
|
66
|
+
* url:
|
67
|
+
* type: string
|
68
|
+
* description: Setup link URL
|
69
|
+
*/
|
43
70
|
class SetupLinkController {
|
44
71
|
constructor({ setupLinkStore }) {
|
45
72
|
this.setupLinkStore = setupLinkStore;
|
46
73
|
}
|
47
|
-
|
74
|
+
/**
|
75
|
+
* @swagger
|
76
|
+
* definitions:
|
77
|
+
* SetupLink:
|
78
|
+
* type: object
|
79
|
+
* example:
|
80
|
+
* {
|
81
|
+
* "data": {
|
82
|
+
* "setupID": "0689f76f7b5aa22f00381a124cb4b153fc1a8c08",
|
83
|
+
* "tenant": "acme",
|
84
|
+
* "product": "my-app",
|
85
|
+
* "service": "sso",
|
86
|
+
* "validTill": 1689849146690,
|
87
|
+
* "url": "http://localhost:5225/setup/0b96a483ebfe0af0b561dda35a96647074d944631ff9e070"
|
88
|
+
* }
|
89
|
+
* }
|
90
|
+
* parameters:
|
91
|
+
* tenantParamPost:
|
92
|
+
* name: tenant
|
93
|
+
* description: Tenant
|
94
|
+
* in: formData
|
95
|
+
* required: true
|
96
|
+
* type: string
|
97
|
+
* productParamPost:
|
98
|
+
* name: product
|
99
|
+
* description: Product
|
100
|
+
* in: formData
|
101
|
+
* required: true
|
102
|
+
* type: string
|
103
|
+
* defaultRedirectUrlParamPost:
|
104
|
+
* name: defaultRedirectUrl
|
105
|
+
* description: The redirect URL to use in the IdP login flow
|
106
|
+
* in: formData
|
107
|
+
* type: string
|
108
|
+
* required: true
|
109
|
+
* redirectUrlParamPost:
|
110
|
+
* name: redirectUrl
|
111
|
+
* description: JSON encoded array containing a list of allowed redirect URLs
|
112
|
+
* in: formData
|
113
|
+
* type: string
|
114
|
+
* required: true
|
115
|
+
* /api/v1/sso/setuplinks:
|
116
|
+
* post:
|
117
|
+
* summary: Create a Setup Link
|
118
|
+
* operationId: create-sso-setup-link
|
119
|
+
* tags: [Setup Links | Single Sign On]
|
120
|
+
* produces:
|
121
|
+
* - application/json
|
122
|
+
* consumes:
|
123
|
+
* - application/x-www-form-urlencoded
|
124
|
+
* - application/json
|
125
|
+
* parameters:
|
126
|
+
* - $ref: '#/parameters/tenantParamPost'
|
127
|
+
* - $ref: '#/parameters/productParamPost'
|
128
|
+
* - $ref: '#/parameters/defaultRedirectUrlParamPost'
|
129
|
+
* - $ref: '#/parameters/redirectUrlParamPost'
|
130
|
+
* responses:
|
131
|
+
* 200:
|
132
|
+
* description: Success
|
133
|
+
* schema:
|
134
|
+
* $ref: '#/definitions/SetupLink'
|
135
|
+
* /api/v1/dsync/setuplinks:
|
136
|
+
* post:
|
137
|
+
* summary: Create a Setup Link
|
138
|
+
* operationId: create-dsync-setup-link
|
139
|
+
* tags: [Setup Links | Directory Sync]
|
140
|
+
* produces:
|
141
|
+
* - application/json
|
142
|
+
* consumes:
|
143
|
+
* - application/x-www-form-urlencoded
|
144
|
+
* - application/json
|
145
|
+
* parameters:
|
146
|
+
* - $ref: '#/parameters/tenantParamPost'
|
147
|
+
* - $ref: '#/parameters/productParamPost'
|
148
|
+
* responses:
|
149
|
+
* 200:
|
150
|
+
* description: Success
|
151
|
+
* schema:
|
152
|
+
* $ref: '#/definitions/SetupLink'
|
153
|
+
*/
|
48
154
|
create(body) {
|
49
155
|
return __awaiter(this, void 0, void 0, function* () {
|
50
156
|
const { tenant, product, service, name, description, defaultRedirectUrl, regenerate, redirectUrl } = body;
|
@@ -53,6 +159,7 @@ class SetupLinkController {
|
|
53
159
|
const redirectUrlList = (0, utils_1.extractRedirectUrls)(redirectUrl || '');
|
54
160
|
(0, utils_1.validateRedirectUrl)({ defaultRedirectUrl, redirectUrlList });
|
55
161
|
}
|
162
|
+
throwIfInvalidService(service);
|
56
163
|
const setupID = dbutils.keyDigest(dbutils.keyFromParts(tenant, product, service));
|
57
164
|
const token = crypto_1.default.randomBytes(24).toString('hex');
|
58
165
|
const existing = (yield this.setupLinkStore.getByIndex({
|
@@ -87,6 +194,9 @@ class SetupLinkController {
|
|
87
194
|
}, {
|
88
195
|
name: utils_1.IndexNames.Service,
|
89
196
|
value: service,
|
197
|
+
}, {
|
198
|
+
name: utils_1.IndexNames.ProductService,
|
199
|
+
value: dbutils.keyFromParts(product, service),
|
90
200
|
});
|
91
201
|
return setupLink;
|
92
202
|
});
|
@@ -110,33 +220,201 @@ class SetupLinkController {
|
|
110
220
|
return setupLink[0];
|
111
221
|
});
|
112
222
|
}
|
113
|
-
|
114
|
-
|
223
|
+
/**
|
224
|
+
* @swagger
|
225
|
+
* parameters:
|
226
|
+
* setupLinkId:
|
227
|
+
* name: id
|
228
|
+
* description: Setup link ID
|
229
|
+
* in: query
|
230
|
+
* required: false
|
231
|
+
* type: string
|
232
|
+
* /api/v1/sso/setuplinks:
|
233
|
+
* delete:
|
234
|
+
* summary: Delete the Setup Link
|
235
|
+
* parameters:
|
236
|
+
* - $ref: '#/parameters/tenantParamGet'
|
237
|
+
* - $ref: '#/parameters/productParamGet'
|
238
|
+
* - $ref: '#/parameters/setupLinkId'
|
239
|
+
* operationId: delete-sso-setup-link
|
240
|
+
* tags: [Setup Links | Single Sign On]
|
241
|
+
* responses:
|
242
|
+
* 200:
|
243
|
+
* description: Success
|
244
|
+
* schema:
|
245
|
+
* type: object
|
246
|
+
* example:
|
247
|
+
* {
|
248
|
+
* data: {}
|
249
|
+
* }
|
250
|
+
* /api/v1/dsync/setuplinks:
|
251
|
+
* delete:
|
252
|
+
* summary: Delete the Setup Link
|
253
|
+
* parameters:
|
254
|
+
* - $ref: '#/parameters/tenantParamGet'
|
255
|
+
* - $ref: '#/parameters/productParamGet'
|
256
|
+
* - $ref: '#/parameters/setupLinkId'
|
257
|
+
* operationId: delete-dsync-setup-link
|
258
|
+
* tags: [Setup Links | Directory Sync]
|
259
|
+
* responses:
|
260
|
+
* 200:
|
261
|
+
* description: Success
|
262
|
+
* schema:
|
263
|
+
* type: object
|
264
|
+
* example:
|
265
|
+
* {
|
266
|
+
* data: {}
|
267
|
+
* }
|
268
|
+
*/
|
269
|
+
remove(params) {
|
115
270
|
return __awaiter(this, void 0, void 0, function* () {
|
116
|
-
if (
|
117
|
-
|
271
|
+
if ('id' in params) {
|
272
|
+
yield this.setupLinkStore.delete(params.id);
|
273
|
+
return;
|
118
274
|
}
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
// Remove a setup link
|
127
|
-
remove(key) {
|
128
|
-
return __awaiter(this, void 0, void 0, function* () {
|
129
|
-
if (!key) {
|
130
|
-
throw new error_1.JacksonError('Missing setup link key', 400);
|
275
|
+
if ('service' in params && 'tenant' in params && 'product' in params) {
|
276
|
+
const { data: setupLinks } = yield this.filterBy({
|
277
|
+
service: params.service,
|
278
|
+
tenant: params.tenant,
|
279
|
+
product: params.product,
|
280
|
+
});
|
281
|
+
yield this.remove({ id: setupLinks[0].setupID });
|
131
282
|
}
|
132
|
-
yield this.setupLinkStore.delete(key);
|
133
|
-
return true;
|
134
283
|
});
|
135
284
|
}
|
136
285
|
// Check if a setup link is expired or not
|
137
286
|
isExpired(setupLink) {
|
138
287
|
return setupLink.validTill < +new Date();
|
139
288
|
}
|
289
|
+
/**
|
290
|
+
* @swagger
|
291
|
+
* parameters:
|
292
|
+
* tenantParamGet:
|
293
|
+
* name: tenant
|
294
|
+
* description: Tenant
|
295
|
+
* in: query
|
296
|
+
* required: true
|
297
|
+
* type: string
|
298
|
+
* productParamGet:
|
299
|
+
* name: product
|
300
|
+
* description: Product
|
301
|
+
* in: query
|
302
|
+
* required: true
|
303
|
+
* type: string
|
304
|
+
* /api/v1/sso/setuplinks/product:
|
305
|
+
* get:
|
306
|
+
* summary: Get the Setup Links by product
|
307
|
+
* parameters:
|
308
|
+
* - $ref: '#/parameters/productParamGet'
|
309
|
+
* operationId: get-sso-setup-link-by-product
|
310
|
+
* tags: [Setup Links | Single Sign On]
|
311
|
+
* responses:
|
312
|
+
* 200:
|
313
|
+
* description: Success
|
314
|
+
* schema:
|
315
|
+
* type: array
|
316
|
+
* items:
|
317
|
+
* $ref: '#/definitions/SetupLink'
|
318
|
+
* /api/v1/dsync/setuplinks/product:
|
319
|
+
* get:
|
320
|
+
* summary: Get the Setup Links by product
|
321
|
+
* parameters:
|
322
|
+
* - $ref: '#/parameters/productParamGet'
|
323
|
+
* operationId: get-dsync-setup-link-by-product
|
324
|
+
* tags: [Setup Links | Directory Sync]
|
325
|
+
* responses:
|
326
|
+
* 200:
|
327
|
+
* description: Success
|
328
|
+
* schema:
|
329
|
+
* type: array
|
330
|
+
* items:
|
331
|
+
* $ref: '#/definitions/SetupLink'
|
332
|
+
*/
|
333
|
+
filterBy(params) {
|
334
|
+
return __awaiter(this, void 0, void 0, function* () {
|
335
|
+
const { tenant, product, service, pageOffset, pageLimit, pageToken } = params;
|
336
|
+
let index = null;
|
337
|
+
// By tenant + product + service
|
338
|
+
if (tenant && product && service) {
|
339
|
+
index = {
|
340
|
+
name: utils_1.IndexNames.TenantProductService,
|
341
|
+
value: dbutils.keyFromParts(tenant, product, service),
|
342
|
+
};
|
343
|
+
}
|
344
|
+
// By product + service
|
345
|
+
else if (product && service) {
|
346
|
+
index = {
|
347
|
+
name: utils_1.IndexNames.ProductService,
|
348
|
+
value: dbutils.keyFromParts(product, service),
|
349
|
+
};
|
350
|
+
}
|
351
|
+
// By service
|
352
|
+
else if (service) {
|
353
|
+
index = {
|
354
|
+
name: utils_1.IndexNames.Service,
|
355
|
+
value: service,
|
356
|
+
};
|
357
|
+
}
|
358
|
+
if (!index) {
|
359
|
+
throw new error_1.JacksonError('Please provide either service or product to filter setup links', 400);
|
360
|
+
}
|
361
|
+
const { data: setupLinks, pageToken: nextPageToken } = yield this.setupLinkStore.getByIndex(index, pageOffset, pageLimit, pageToken);
|
362
|
+
if (index.name === utils_1.IndexNames.TenantProductService && setupLinks.length === 0) {
|
363
|
+
throw new error_1.JacksonError('Setup link is not found', 404);
|
364
|
+
}
|
365
|
+
return { data: setupLinks, pageToken: nextPageToken };
|
366
|
+
});
|
367
|
+
}
|
368
|
+
/**
|
369
|
+
* @swagger
|
370
|
+
* parameters:
|
371
|
+
* idParamGet:
|
372
|
+
* name: id
|
373
|
+
* description: Setup Link ID
|
374
|
+
* in: query
|
375
|
+
* required: false
|
376
|
+
* type: string
|
377
|
+
* /api/v1/sso/setuplinks:
|
378
|
+
* get:
|
379
|
+
* summary: Get the Setup Link
|
380
|
+
* parameters:
|
381
|
+
* - $ref: '#/parameters/tenantParamGet'
|
382
|
+
* - $ref: '#/parameters/productParamGet'
|
383
|
+
* - $ref: '#/parameters/idParamGet'
|
384
|
+
* operationId: get-sso-setup-link
|
385
|
+
* tags: [Setup Links | Single Sign On]
|
386
|
+
* responses:
|
387
|
+
* 200:
|
388
|
+
* description: Success
|
389
|
+
* schema:
|
390
|
+
* $ref: '#/definitions/SetupLink'
|
391
|
+
* /api/v1/dsync/setuplinks:
|
392
|
+
* get:
|
393
|
+
* summary: Get the Setup Link
|
394
|
+
* parameters:
|
395
|
+
* - $ref: '#/parameters/tenantParamGet'
|
396
|
+
* - $ref: '#/parameters/productParamGet'
|
397
|
+
* - $ref: '#/parameters/idParamGet'
|
398
|
+
* operationId: get-dsync-setup-link
|
399
|
+
* tags: [Setup Links | Directory Sync]
|
400
|
+
* responses:
|
401
|
+
* 200:
|
402
|
+
* description: Success
|
403
|
+
* schema:
|
404
|
+
* $ref: '#/definitions/SetupLink'
|
405
|
+
*/
|
406
|
+
get(id) {
|
407
|
+
return __awaiter(this, void 0, void 0, function* () {
|
408
|
+
if (!id) {
|
409
|
+
throw new error_1.JacksonError('Missing setup link id', 400);
|
410
|
+
}
|
411
|
+
const setupLink = yield this.setupLinkStore.get(id);
|
412
|
+
if (!setupLink) {
|
413
|
+
throw new error_1.JacksonError('Setup link is not found', 404);
|
414
|
+
}
|
415
|
+
return setupLink;
|
416
|
+
});
|
417
|
+
}
|
140
418
|
}
|
141
419
|
exports.SetupLinkController = SetupLinkController;
|
142
420
|
//# sourceMappingURL=setup-link.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"setup-link.js","sourceRoot":"","sources":["../../src/controller/setup-link.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"setup-link.js","sourceRoot":"","sources":["../../src/controller/setup-link.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,qDAAuC;AACvC,mCAAyG;AACzG,oDAA4B;AAC5B,mCAAuC;AAkBvC,MAAM,qBAAqB,GAAG,CAAC,OAAe,EAAE,EAAE;IAChD,IAAI,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QACvC,MAAM,IAAI,oBAAY,CAAC,4DAA4D,EA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AAC,MAAM,KAAK,CAAC,EAAE;gBAC7E,MAAM,IAAI,oBAAY,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;aACxD;YAED,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;QACxD,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACG,GAAG,CAAC,EAAU;;YAClB,IAAI,CAAC,EAAE,EAAE;gBACP,MAAM,IAAI,oBAAY,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;aACtD;YAED,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAEpD,IAAI,CAAC,SAAS,EAAE;gBACd,MAAM,IAAI,oBAAY,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;aACxD;YAED,OAAO,SAAS,CAAC;QACnB,CAAC;KAAA;CACF;AArYD,kDAqYC"}
|
@@ -3,13 +3,14 @@ import { Client, TokenSet } from 'openid-client';
|
|
3
3
|
import type { ConnectionType, OAuthErrorHandlerParams, SAMLSSOConnectionWithEncodedMetadata, SAMLSSOConnectionWithRawMetadata, OIDCSSOConnectionWithDiscoveryUrl, OIDCSSOConnectionWithMetadata, Profile, SAMLSSORecord, OIDCSSORecord, Directory } from '../typings';
|
4
4
|
export declare enum IndexNames {
|
5
5
|
EntityID = "entityID",
|
6
|
-
SetupToken = "token",
|
7
6
|
TenantProduct = "tenantProduct",
|
8
|
-
TenantProductService = "tenantProductService",
|
9
|
-
Service = "service",
|
10
7
|
OIDCProviderClientID = "OIDCProviderClientID",
|
11
8
|
SSOClientID = "SSOClientID",
|
12
|
-
Product = "product"
|
9
|
+
Product = "product",
|
10
|
+
Service = "service",
|
11
|
+
SetupToken = "token",
|
12
|
+
ProductService = "productService",
|
13
|
+
TenantProductService = "tenantProductService"
|
13
14
|
}
|
14
15
|
export declare const storeNamespacePrefix: {
|
15
16
|
dsync: {
|
package/dist/controller/utils.js
CHANGED
@@ -44,13 +44,15 @@ const redirect = __importStar(require("./oauth/redirect"));
|
|
44
44
|
var IndexNames;
|
45
45
|
(function (IndexNames) {
|
46
46
|
IndexNames["EntityID"] = "entityID";
|
47
|
-
IndexNames["SetupToken"] = "token";
|
48
47
|
IndexNames["TenantProduct"] = "tenantProduct";
|
49
|
-
IndexNames["TenantProductService"] = "tenantProductService";
|
50
|
-
IndexNames["Service"] = "service";
|
51
48
|
IndexNames["OIDCProviderClientID"] = "OIDCProviderClientID";
|
52
49
|
IndexNames["SSOClientID"] = "SSOClientID";
|
53
50
|
IndexNames["Product"] = "product";
|
51
|
+
// For Setup link
|
52
|
+
IndexNames["Service"] = "service";
|
53
|
+
IndexNames["SetupToken"] = "token";
|
54
|
+
IndexNames["ProductService"] = "productService";
|
55
|
+
IndexNames["TenantProductService"] = "tenantProductService";
|
54
56
|
})(IndexNames || (exports.IndexNames = IndexNames = {}));
|
55
57
|
// The namespace prefix for the database store
|
56
58
|
exports.storeNamespacePrefix = {
|