@boxyhq/saml-jackson 0.3.6-beta.650 → 0.3.6-beta.655

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.
@@ -40,6 +40,9 @@ const allowed = __importStar(require("./oauth/allowed"));
40
40
  const codeVerifier = __importStar(require("./oauth/code-verifier"));
41
41
  const redirect = __importStar(require("./oauth/redirect"));
42
42
  const utils_1 = require("./utils");
43
+ const util_1 = require("util");
44
+ const zlib_1 = require("zlib");
45
+ const deflateRawAsync = (0, util_1.promisify)(zlib_1.deflateRaw);
43
46
  const relayStatePrefix = 'boxyhq_jackson_';
44
47
  function getEncodedClientId(client_id) {
45
48
  try {
@@ -131,20 +134,21 @@ class OAuthController {
131
134
  code_challenge_method,
132
135
  });
133
136
  const relayState = relayStatePrefix + sessionId;
134
- const samlReqEnc = Buffer.from(samlReq.request).toString('base64');
135
137
  const { sso } = samlConfig.idpMetadata;
136
138
  let redirectUrl = '';
137
139
  let authorizeForm = '';
138
- // HTTP redirect binding
140
+ // HTTP Redirect binding
139
141
  if ('redirectUrl' in sso) {
142
+ const samlReqEnc = yield deflateRawAsync(samlReq.request);
140
143
  redirectUrl = redirect.success(sso.redirectUrl, {
141
144
  RelayState: relayState,
142
- SAMLRequest: samlReqEnc,
145
+ SAMLRequest: Buffer.from(samlReqEnc).toString('base64'),
143
146
  });
144
147
  }
145
148
  // HTTP POST binding
146
149
  if ('postUrl' in sso) {
147
- authorizeForm = (0, utils_1.createAuthorizeForm)(relayState, samlReqEnc, sso.postUrl);
150
+ const samlReqEnc = Buffer.from(samlReq.request).toString('base64');
151
+ authorizeForm = (0, utils_1.createAuthorizeForm)(relayState, encodeURI(samlReqEnc), sso.postUrl);
148
152
  }
149
153
  return {
150
154
  redirect_url: redirectUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boxyhq/saml-jackson",
3
- "version": "0.3.6-beta.650",
3
+ "version": "0.3.6-beta.655",
4
4
  "description": "SAML 2.0 service",
5
5
  "keywords": [
6
6
  "SAML 2.0"