@boxyhq/saml-jackson 0.3.5-beta.355 → 0.3.6

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 {
@@ -130,9 +133,11 @@ class OAuthController {
130
133
  code_challenge,
131
134
  code_challenge_method,
132
135
  });
136
+ // deepak: When supporting HTTP-POST skip deflate
137
+ const samlReqEnc = yield deflateRawAsync(samlReq.request);
133
138
  const redirectUrl = redirect.success(samlConfig.idpMetadata.sso.redirectUrl, {
134
139
  RelayState: relayStatePrefix + sessionId,
135
- SAMLRequest: Buffer.from(samlReq.request).toString('base64'),
140
+ SAMLRequest: Buffer.from(samlReqEnc).toString('base64'),
136
141
  });
137
142
  return { redirect_url: redirectUrl };
138
143
  });
@@ -333,8 +338,11 @@ class OAuthController {
333
338
  */
334
339
  userInfo(token) {
335
340
  return __awaiter(this, void 0, void 0, function* () {
336
- const { claims } = yield this.tokenStore.get(token);
337
- return claims;
341
+ const rsp = yield this.tokenStore.get(token);
342
+ if (!rsp || !rsp.claims) {
343
+ throw new error_1.JacksonError('Invalid token', 403);
344
+ }
345
+ return rsp.claims;
338
346
  });
339
347
  }
340
348
  }
@@ -43,9 +43,15 @@ class Sql {
43
43
  return __awaiter(this, void 0, void 0, function* () {
44
44
  while (true) {
45
45
  try {
46
- // to support self signed cert like heroku postgres
47
- const sslOpts = this.options.sslRejectUnauthorized === false ? { ssl: { rejectUnauthorized: false } } : undefined;
48
- this.connection = yield (0, typeorm_1.createConnection)(Object.assign({ name: this.options.type + Math.floor(Math.random() * 100000), type: this.options.type, url: this.options.url, synchronize: true, migrationsTableName: '_jackson_migrations', logging: ['error'], entities: [JacksonStore_1.JacksonStore, JacksonIndex_1.JacksonIndex, JacksonTTL_1.JacksonTTL] }, sslOpts));
46
+ this.connection = yield (0, typeorm_1.createConnection)({
47
+ name: this.options.type + Math.floor(Math.random() * 100000),
48
+ type: this.options.type,
49
+ url: this.options.url,
50
+ synchronize: true,
51
+ migrationsTableName: '_jackson_migrations',
52
+ logging: ['error'],
53
+ entities: [JacksonStore_1.JacksonStore, JacksonIndex_1.JacksonIndex, JacksonTTL_1.JacksonTTL],
54
+ });
49
55
  break;
50
56
  }
51
57
  catch (err) {
package/dist/index.js CHANGED
@@ -44,8 +44,6 @@ const defaultOpts = (opts) => {
44
44
  newOpts.db.type = newOpts.db.type || 'postgres'; // Only needed if DB_ENGINE is sql.
45
45
  newOpts.db.ttl = (newOpts.db.ttl || 300) * 1; // TTL for the code, session and token stores (in seconds)
46
46
  newOpts.db.cleanupLimit = (newOpts.db.cleanupLimit || 1000) * 1; // Limit cleanup of TTL entries to this many items at a time
47
- newOpts.db.sslRejectUnauthorized =
48
- typeof newOpts.db.sslRejectUnauthorized === 'boolean' ? newOpts.db.sslRejectUnauthorized : true;
49
47
  return newOpts;
50
48
  };
51
49
  const controllers = (opts) => __awaiter(void 0, void 0, void 0, function* () {
package/dist/typings.d.ts CHANGED
@@ -99,7 +99,6 @@ export interface DatabaseOption {
99
99
  ttl?: number;
100
100
  cleanupLimit?: number;
101
101
  encryptionKey?: string;
102
- sslRejectUnauthorized?: boolean;
103
102
  }
104
103
  export interface SAMLReq {
105
104
  ssoUrl?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boxyhq/saml-jackson",
3
- "version": "0.3.5-beta.355",
3
+ "version": "0.3.6",
4
4
  "description": "SAML 2.0 service",
5
5
  "keywords": [
6
6
  "SAML 2.0"