@boxyhq/saml-jackson 0.3.5-beta.339 → 0.3.5-beta.346

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.
@@ -1,16 +1,143 @@
1
- import { IdPConfig, IAPIController, OAuth } from '../typings';
1
+ import { IAPIController, IdPConfig, OAuth } from '../typings';
2
2
  export declare class APIController implements IAPIController {
3
3
  private configStore;
4
4
  constructor({ configStore }: {
5
5
  configStore: any;
6
6
  });
7
7
  private _validateIdPConfig;
8
+ /**
9
+ * @swagger
10
+ *
11
+ * /api/v1/saml/config:
12
+ * post:
13
+ * description: Create SAML configuration
14
+ * operationId: create-saml-config
15
+ * tags: [SAML Config]
16
+ * produces:
17
+ * - application/json
18
+ * consumes:
19
+ * - application/x-www-form-urlencoded
20
+ * parameters:
21
+ * - name: encodedRawMetadata
22
+ * description: Base64 encoding of the XML metadata
23
+ * in: formData
24
+ * required: true
25
+ * type: string
26
+ * - name: defaultRedirectUrl
27
+ * description: The redirect URL to use in the IdP login flow
28
+ * in: formData
29
+ * required: true
30
+ * type: string
31
+ * - name: redirectUrl
32
+ * description: JSON encoded array containing a list of allowed redirect URLs
33
+ * in: formData
34
+ * required: true
35
+ * type: string
36
+ * - name: tenant
37
+ * description: Tenant
38
+ * in: formData
39
+ * required: true
40
+ * type: string
41
+ * - name: product
42
+ * description: Product
43
+ * in: formData
44
+ * required: true
45
+ * type: string
46
+ * responses:
47
+ * 200:
48
+ * description: Success
49
+ * schema:
50
+ * type: object
51
+ * properties:
52
+ * client_id:
53
+ * type: string
54
+ * client_secret:
55
+ * type: string
56
+ * provider:
57
+ * type: string
58
+ * example:
59
+ * client_id: 8958e13053832b5af58fdf2ee83f35f5d013dc74
60
+ * client_secret: 13f01f4df5b01770c616e682d14d3ba23f20948cfa89b1d7
61
+ * type: accounts.google.com
62
+ * 401:
63
+ * description: Unauthorized
64
+ */
8
65
  config(body: IdPConfig): Promise<OAuth>;
66
+ /**
67
+ * @swagger
68
+ *
69
+ * /api/v1/saml/config:
70
+ * get:
71
+ * summary: Get SAML configuration
72
+ * operationId: get-saml-config
73
+ * tags:
74
+ * - SAML Config
75
+ * parameters:
76
+ * - in: query
77
+ * name: tenant
78
+ * type: string
79
+ * description: Tenant
80
+ * - in: query
81
+ * name: product
82
+ * type: string
83
+ * description: Product
84
+ * - in: query
85
+ * name: clientID
86
+ * type: string
87
+ * description: Client ID
88
+ * responses:
89
+ * '200':
90
+ * description: Success
91
+ * schema:
92
+ * type: object
93
+ * properties:
94
+ * provider:
95
+ * type: string
96
+ * example:
97
+ * type: accounts.google.com
98
+ * '401':
99
+ * description: Unauthorized
100
+ */
9
101
  getConfig(body: {
10
102
  clientID: string;
11
103
  tenant: string;
12
104
  product: string;
13
105
  }): Promise<Partial<OAuth>>;
106
+ /**
107
+ * @swagger
108
+ * /api/v1/saml/config:
109
+ * delete:
110
+ * summary: Delete SAML configuration
111
+ * operationId: delete-saml-config
112
+ * tags:
113
+ * - SAML Config
114
+ * consumes:
115
+ * - application/x-www-form-urlencoded
116
+ * parameters:
117
+ * - name: clientID
118
+ * in: formData
119
+ * type: string
120
+ * required: true
121
+ * description: Client ID
122
+ * - name: clientSecret
123
+ * in: formData
124
+ * type: string
125
+ * required: true
126
+ * description: Client Secret
127
+ * - name: tenant
128
+ * in: formData
129
+ * type: string
130
+ * description: Tenant
131
+ * - name: product
132
+ * in: formData
133
+ * type: string
134
+ * description: Product
135
+ * responses:
136
+ * '200':
137
+ * description: Success
138
+ * '401':
139
+ * description: Unauthorized
140
+ */
14
141
  deleteConfig(body: {
15
142
  clientID: string;
16
143
  clientSecret: string;
@@ -60,6 +60,63 @@ class APIController {
60
60
  throw new error_1.JacksonError('Please provide product', 400);
61
61
  }
62
62
  }
63
+ /**
64
+ * @swagger
65
+ *
66
+ * /api/v1/saml/config:
67
+ * post:
68
+ * description: Create SAML configuration
69
+ * operationId: create-saml-config
70
+ * tags: [SAML Config]
71
+ * produces:
72
+ * - application/json
73
+ * consumes:
74
+ * - application/x-www-form-urlencoded
75
+ * parameters:
76
+ * - name: encodedRawMetadata
77
+ * description: Base64 encoding of the XML metadata
78
+ * in: formData
79
+ * required: true
80
+ * type: string
81
+ * - name: defaultRedirectUrl
82
+ * description: The redirect URL to use in the IdP login flow
83
+ * in: formData
84
+ * required: true
85
+ * type: string
86
+ * - name: redirectUrl
87
+ * description: JSON encoded array containing a list of allowed redirect URLs
88
+ * in: formData
89
+ * required: true
90
+ * type: string
91
+ * - name: tenant
92
+ * description: Tenant
93
+ * in: formData
94
+ * required: true
95
+ * type: string
96
+ * - name: product
97
+ * description: Product
98
+ * in: formData
99
+ * required: true
100
+ * type: string
101
+ * responses:
102
+ * 200:
103
+ * description: Success
104
+ * schema:
105
+ * type: object
106
+ * properties:
107
+ * client_id:
108
+ * type: string
109
+ * client_secret:
110
+ * type: string
111
+ * provider:
112
+ * type: string
113
+ * example:
114
+ * client_id: 8958e13053832b5af58fdf2ee83f35f5d013dc74
115
+ * client_secret: 13f01f4df5b01770c616e682d14d3ba23f20948cfa89b1d7
116
+ * type: accounts.google.com
117
+ * 401:
118
+ * description: Unauthorized
119
+ */
63
120
  config(body) {
64
121
  return __awaiter(this, void 0, void 0, function* () {
65
122
  const { encodedRawMetadata, rawMetadata, defaultRedirectUrl, redirectUrl, tenant, product } = body;
@@ -113,6 +170,41 @@ class APIController {
113
170
  };
114
171
  });
115
172
  }
173
+ /**
174
+ * @swagger
175
+ *
176
+ * /api/v1/saml/config:
177
+ * get:
178
+ * summary: Get SAML configuration
179
+ * operationId: get-saml-config
180
+ * tags:
181
+ * - SAML Config
182
+ * parameters:
183
+ * - in: query
184
+ * name: tenant
185
+ * type: string
186
+ * description: Tenant
187
+ * - in: query
188
+ * name: product
189
+ * type: string
190
+ * description: Product
191
+ * - in: query
192
+ * name: clientID
193
+ * type: string
194
+ * description: Client ID
195
+ * responses:
196
+ * '200':
197
+ * description: Success
198
+ * schema:
199
+ * type: object
200
+ * properties:
201
+ * provider:
202
+ * type: string
203
+ * example:
204
+ * type: accounts.google.com
205
+ * '401':
206
+ * description: Unauthorized
207
+ */
116
208
  getConfig(body) {
117
209
  return __awaiter(this, void 0, void 0, function* () {
118
210
  const { clientID, tenant, product } = body;
@@ -133,6 +225,41 @@ class APIController {
133
225
  throw new error_1.JacksonError('Please provide `clientID` or `tenant` and `product`.', 400);
134
226
  });
135
227
  }
228
+ /**
229
+ * @swagger
230
+ * /api/v1/saml/config:
231
+ * delete:
232
+ * summary: Delete SAML configuration
233
+ * operationId: delete-saml-config
234
+ * tags:
235
+ * - SAML Config
236
+ * consumes:
237
+ * - application/x-www-form-urlencoded
238
+ * parameters:
239
+ * - name: clientID
240
+ * in: formData
241
+ * type: string
242
+ * required: true
243
+ * description: Client ID
244
+ * - name: clientSecret
245
+ * in: formData
246
+ * type: string
247
+ * required: true
248
+ * description: Client Secret
249
+ * - name: tenant
250
+ * in: formData
251
+ * type: string
252
+ * description: Tenant
253
+ * - name: product
254
+ * in: formData
255
+ * type: string
256
+ * description: Product
257
+ * responses:
258
+ * '200':
259
+ * description: Success
260
+ * '401':
261
+ * description: Unauthorized
262
+ */
136
263
  deleteConfig(body) {
137
264
  return __awaiter(this, void 0, void 0, function* () {
138
265
  const { clientID, clientSecret, tenant, product } = body;
@@ -18,6 +18,90 @@ export declare class OAuthController implements IOAuthController {
18
18
  samlResponse(body: SAMLResponsePayload): Promise<{
19
19
  redirect_url: string;
20
20
  }>;
21
+ /**
22
+ * @swagger
23
+ *
24
+ * /oauth/token:
25
+ * post:
26
+ * summary: Code exchange
27
+ * operationId: oauth-code-exchange
28
+ * tags:
29
+ * - OAuth
30
+ * consumes:
31
+ * - application/x-www-form-urlencoded
32
+ * parameters:
33
+ * - name: grant_type
34
+ * in: formData
35
+ * type: string
36
+ * description: Grant type should be 'authorization_code'
37
+ * default: authorization_code
38
+ * required: true
39
+ * - name: client_id
40
+ * in: formData
41
+ * type: string
42
+ * description: Use the client_id returned by the SAML config API
43
+ * required: true
44
+ * - name: client_secret
45
+ * in: formData
46
+ * type: string
47
+ * description: Use the client_secret returned by the SAML config API
48
+ * required: true
49
+ * - name: redirect_uri
50
+ * in: formData
51
+ * type: string
52
+ * description: Redirect URI
53
+ * required: true
54
+ * - name: code
55
+ * in: formData
56
+ * type: string
57
+ * description: Code
58
+ * required: true
59
+ * responses:
60
+ * '200':
61
+ * description: Success
62
+ * schema:
63
+ * type: object
64
+ * properties:
65
+ * access_token:
66
+ * type: string
67
+ * token_type:
68
+ * type: string
69
+ * expires_in:
70
+ * type: string
71
+ * example:
72
+ * access_token: 8958e13053832b5af58fdf2ee83f35f5d013dc74
73
+ * token_type: bearer
74
+ * expires_in: 300
75
+ */
21
76
  token(body: OAuthTokenReq): Promise<OAuthTokenRes>;
77
+ /**
78
+ * @swagger
79
+ *
80
+ * /oauth/userinfo:
81
+ * get:
82
+ * summary: Get profile
83
+ * operationId: oauth-get-profile
84
+ * tags:
85
+ * - OAuth
86
+ * responses:
87
+ * '200':
88
+ * description: Success
89
+ * schema:
90
+ * type: object
91
+ * properties:
92
+ * id:
93
+ * type: string
94
+ * email:
95
+ * type: string
96
+ * firstName:
97
+ * type: string
98
+ * lastName:
99
+ * type: string
100
+ * example:
101
+ * id: 32b5af58fdf
102
+ * email: jackson@coolstartup.com
103
+ * firstName: SAML
104
+ * lastName: Jackson
105
+ */
22
106
  userInfo(token: string): Promise<Profile>;
23
107
  }
@@ -199,6 +199,61 @@ class OAuthController {
199
199
  return { redirect_url: redirectUrl };
200
200
  });
201
201
  }
202
+ /**
203
+ * @swagger
204
+ *
205
+ * /oauth/token:
206
+ * post:
207
+ * summary: Code exchange
208
+ * operationId: oauth-code-exchange
209
+ * tags:
210
+ * - OAuth
211
+ * consumes:
212
+ * - application/x-www-form-urlencoded
213
+ * parameters:
214
+ * - name: grant_type
215
+ * in: formData
216
+ * type: string
217
+ * description: Grant type should be 'authorization_code'
218
+ * default: authorization_code
219
+ * required: true
220
+ * - name: client_id
221
+ * in: formData
222
+ * type: string
223
+ * description: Use the client_id returned by the SAML config API
224
+ * required: true
225
+ * - name: client_secret
226
+ * in: formData
227
+ * type: string
228
+ * description: Use the client_secret returned by the SAML config API
229
+ * required: true
230
+ * - name: redirect_uri
231
+ * in: formData
232
+ * type: string
233
+ * description: Redirect URI
234
+ * required: true
235
+ * - name: code
236
+ * in: formData
237
+ * type: string
238
+ * description: Code
239
+ * required: true
240
+ * responses:
241
+ * '200':
242
+ * description: Success
243
+ * schema:
244
+ * type: object
245
+ * properties:
246
+ * access_token:
247
+ * type: string
248
+ * token_type:
249
+ * type: string
250
+ * expires_in:
251
+ * type: string
252
+ * example:
253
+ * access_token: 8958e13053832b5af58fdf2ee83f35f5d013dc74
254
+ * token_type: bearer
255
+ * expires_in: 300
256
+ */
202
257
  token(body) {
203
258
  return __awaiter(this, void 0, void 0, function* () {
204
259
  const { client_id, client_secret, code_verifier, code, grant_type = 'authorization_code' } = body;
@@ -247,6 +302,35 @@ class OAuthController {
247
302
  };
248
303
  });
249
304
  }
305
+ /**
306
+ * @swagger
307
+ *
308
+ * /oauth/userinfo:
309
+ * get:
310
+ * summary: Get profile
311
+ * operationId: oauth-get-profile
312
+ * tags:
313
+ * - OAuth
314
+ * responses:
315
+ * '200':
316
+ * description: Success
317
+ * schema:
318
+ * type: object
319
+ * properties:
320
+ * id:
321
+ * type: string
322
+ * email:
323
+ * type: string
324
+ * firstName:
325
+ * type: string
326
+ * lastName:
327
+ * type: string
328
+ * example:
329
+ * id: 32b5af58fdf
330
+ * email: jackson@coolstartup.com
331
+ * firstName: SAML
332
+ * lastName: Jackson
333
+ */
250
334
  userInfo(token) {
251
335
  return __awaiter(this, void 0, void 0, function* () {
252
336
  const { claims } = yield this.tokenStore.get(token);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boxyhq/saml-jackson",
3
- "version": "0.3.5-beta.339",
3
+ "version": "0.3.5-beta.346",
4
4
  "description": "SAML 2.0 service",
5
5
  "keywords": [
6
6
  "SAML 2.0"