@boxyhq/saml-jackson 0.3.6-beta.656 → 0.3.6-beta.660

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.
@@ -14,7 +14,6 @@ export declare class OAuthController implements IOAuthController {
14
14
  });
15
15
  authorize(body: OAuthReqBody): Promise<{
16
16
  redirect_url: string;
17
- authorize_form: string;
18
17
  }>;
19
18
  samlResponse(body: SAMLResponsePayload): Promise<{
20
19
  redirect_url: string;
@@ -133,33 +133,19 @@ class OAuthController {
133
133
  code_challenge,
134
134
  code_challenge_method,
135
135
  });
136
- const relayState = relayStatePrefix + sessionId;
137
- const { sso } = samlConfig.idpMetadata;
138
- let redirectUrl = '';
139
- let authorizeForm = '';
140
- // HTTP Redirect binding
141
- if ('redirectUrl' in sso) {
142
- const samlReqEnc = yield deflateRawAsync(samlReq.request);
143
- redirectUrl = redirect.success(sso.redirectUrl, {
144
- RelayState: relayState,
145
- SAMLRequest: Buffer.from(samlReqEnc).toString('base64'),
146
- });
147
- }
148
- // HTTP POST binding
149
- if ('postUrl' in sso) {
150
- const samlReqEnc = Buffer.from(samlReq.request).toString('base64');
151
- authorizeForm = (0, utils_1.createAuthorizeForm)(relayState, encodeURI(samlReqEnc), sso.postUrl);
152
- }
153
- return {
154
- redirect_url: redirectUrl,
155
- authorize_form: authorizeForm,
156
- };
136
+ // deepak: When supporting HTTP-POST skip deflate
137
+ const samlReqEnc = yield deflateRawAsync(samlReq.request);
138
+ const redirectUrl = redirect.success(samlConfig.idpMetadata.sso.redirectUrl, {
139
+ RelayState: relayStatePrefix + sessionId,
140
+ SAMLRequest: Buffer.from(samlReqEnc).toString('base64'),
141
+ });
142
+ return { redirect_url: redirectUrl };
157
143
  });
158
144
  }
159
145
  samlResponse(body) {
160
146
  return __awaiter(this, void 0, void 0, function* () {
161
- const { SAMLResponse } = body; // RelayState will contain the sessionId from earlier quasi-oauth flow
162
- let RelayState = body.RelayState || '';
147
+ const { SAMLResponse } = body;
148
+ let RelayState = body.RelayState || ''; // RelayState will contain the sessionId from earlier quasi-oauth flow
163
149
  if (!this.opts.idpEnabled && !RelayState.startsWith(relayStatePrefix)) {
164
150
  // IDP is disabled so block the request
165
151
  throw new error_1.JacksonError('IdP (Identity Provider) flow has been disabled. Please head to your Service Provider to login.', 403);
@@ -2,4 +2,3 @@ export declare enum IndexNames {
2
2
  EntityID = "entityID",
3
3
  TenantProduct = "tenantProduct"
4
4
  }
5
- export declare const createAuthorizeForm: (relayState: string, samlReqEnc: string, postUrl: string) => string;
@@ -1,32 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAuthorizeForm = exports.IndexNames = void 0;
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/typings.d.ts CHANGED
@@ -28,7 +28,6 @@ export interface IAPIController {
28
28
  export interface IOAuthController {
29
29
  authorize(body: OAuthReqBody): Promise<{
30
30
  redirect_url: string;
31
- authorize_form: string;
32
31
  }>;
33
32
  samlResponse(body: SAMLResponsePayload): Promise<{
34
33
  redirect_url: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boxyhq/saml-jackson",
3
- "version": "0.3.6-beta.656",
3
+ "version": "0.3.6-beta.660",
4
4
  "description": "SAML 2.0 service",
5
5
  "keywords": [
6
6
  "SAML 2.0"
@@ -39,6 +39,8 @@
39
39
  "@boxyhq/saml20": "0.2.0",
40
40
  "@peculiar/webcrypto": "1.2.3",
41
41
  "@peculiar/x509": "1.6.1",
42
+ "cors": "2.8.5",
43
+ "express": "4.17.2",
42
44
  "mongodb": "4.3.1",
43
45
  "mysql2": "2.3.3",
44
46
  "pg": "8.7.3",
@@ -53,6 +55,7 @@
53
55
  "xmlbuilder": "15.1.1"
54
56
  },
55
57
  "devDependencies": {
58
+ "@types/express": "4.17.13",
56
59
  "@types/node": "17.0.16",
57
60
  "@types/sinon": "10.0.11",
58
61
  "@types/tap": "15.0.5",