@boxyhq/saml-jackson 0.2.1-beta.156 → 0.2.1-beta.157

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/README.md CHANGED
@@ -321,20 +321,23 @@ Configuration is done via env vars (and in the case of the npm library via an op
321
321
 
322
322
  The following options are supported and will have to be configured during deployment.
323
323
 
324
- | Key | Description | Default |
325
- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
326
- | HOST_URL | The URL to bind to | `localhost` |
327
- | HOST_PORT | The port to bind to | `5000` |
328
- | EXTERNAL_URL (npm: externalUrl) | The public URL to reach this service, used internally for documenting the SAML configuration instructions. | `http://{HOST_URL}:{HOST_PORT}` |
329
- | INTERNAL_HOST_URL | The URL to bind to expose the internal APIs. Do not configure this to a public network. | `localhost` |
330
- | INTERNAL_HOST_PORT | The port to bind to for the internal APIs. | `6000` |
331
- | JACKSON_API_KEYS | A comma separated list of API keys that will be validated when serving the Config API requests | |
332
- | SAML_AUDIENCE (npm: samlAudience) | This is just an identifier to validate the SAML audience, this value will also get configured in the SAML apps created by your customers. Once set do not change this value unless you get your customers to reconfigure their SAML again. It is case-sensitive. This does not have to be a real URL. | `https://saml.boxyhq.com` |
333
- | IDP_ENABLED (npm: idpEnabled) | Set to `true` to enable IdP initiated login for SAML. SP initiated login is the only recommended flow but you might have to support IdP login at times. | `false` |
334
- | DB_ENGINE (npm: db.engine) | Supported values are `redis`, `sql`, `mongo`, `mem`. | `sql` |
335
- | DB_URL (npm: db.url) | The database URL to connect to. For example `postgres://postgres:postgres@localhost:5450/jackson` | |
336
- | DB_TYPE (npm: db.type) | Only needed when DB_ENGINE is `sql`. Supported values are `postgres`, `cockroachdb`, `mysql`, `mariadb`. | `postgres` |
337
- | PRE_LOADED_CONFIG | If you only need a single tenant or a handful of pre-configured tenants then this config will help you read and load SAML configs. It works well with the mem DB engine so you don't have to configure any external databases for this to work (though it works with those as well). This is a path (absolute or relative) to a directory that contains files organized in the format described in the next section. | |
324
+ | Key | Description | Default |
325
+ | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
326
+ | HOST_URL | The URL to bind to | `localhost` |
327
+ | HOST_PORT | The port to bind to | `5000` |
328
+ | EXTERNAL_URL (npm: externalUrl) | The public URL to reach this service, used internally for documenting the SAML configuration instructions. | `http://{HOST_URL}:{HOST_PORT}` |
329
+ | INTERNAL_HOST_URL | The URL to bind to expose the internal APIs. Do not configure this to a public network. | `localhost` |
330
+ | INTERNAL_HOST_PORT | The port to bind to for the internal APIs. | `6000` |
331
+ | JACKSON_API_KEYS | A comma separated list of API keys that will be validated when serving the Config API requests | |
332
+ | SAML_AUDIENCE (npm: samlAudience) | This is just an identifier to validate the SAML audience, this value will also get configured in the SAML apps created by your customers. Once set do not change this value unless you get your customers to reconfigure their SAML again. It is case-sensitive. This does not have to be a real URL. | `https://saml.boxyhq.com` |
333
+ | IDP_ENABLED (npm: idpEnabled) | Set to `true` to enable IdP initiated login for SAML. SP initiated login is the only recommended flow but you might have to support IdP login at times. | `false` |
334
+ | DB_ENGINE (npm: db.engine) | Supported values are `redis`, `sql`, `mongo`, `mem`. | `sql` |
335
+ | DB_URL (npm: db.url) | The database URL to connect to. For example `postgres://postgres:postgres@localhost:5450/jackson` | |
336
+ | DB_TYPE (npm: db.type) | Only needed when DB_ENGINE is `sql`. Supported values are `postgres`, `cockroachdb`, `mysql`, `mariadb`. | `postgres` |
337
+ | DB_TTL (npm: db.ttl) | TTL for the code, session and token stores (in seconds). | 300 |
338
+ | DB_CLEANUP_LIMIT (npm: db.cleanupLimit) | Limit cleanup of TTL entries to this number. | 1000 |
339
+ | DB_ENCRYPTION_KEY (npm: db.encryptionKey) | To encrypt data at rest specify a 32 character key. | |
340
+ | PRE_LOADED_CONFIG | If you only need a single tenant or a handful of pre-configured tenants then this config will help you read and load SAML configs. It works well with the mem DB engine so you don't have to configure any external databases for this to work (though it works with those as well). This is a path (absolute or relative) to a directory that contains files organized in the format described in the next section. | |
338
341
 
339
342
  ## Pre-loaded SAML Configuration
340
343
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boxyhq/saml-jackson",
3
- "version": "0.2.1-beta.156",
3
+ "version": "0.2.1-beta.157",
4
4
  "license": "Apache 2.0",
5
5
  "description": "SAML 2.0 service",
6
6
  "main": "src/index.js",
package/src/db/db.test.js CHANGED
@@ -34,7 +34,7 @@ const postgresDbConfig = {
34
34
  url: 'postgresql://postgres:postgres@localhost:5432/postgres',
35
35
  type: 'postgres',
36
36
  ttl: 1,
37
- limit: 1,
37
+ cleanupLimit: 1,
38
38
  };
39
39
 
40
40
  const mongoDbConfig = {
@@ -47,7 +47,7 @@ const mysqlDbConfig = {
47
47
  url: 'mysql://root:mysql@localhost:3307/mysql',
48
48
  type: 'mysql',
49
49
  ttl: 1,
50
- limit: 1,
50
+ cleanupLimit: 1,
51
51
  };
52
52
 
53
53
  const mariadbDbConfig = {
@@ -55,7 +55,7 @@ const mariadbDbConfig = {
55
55
  url: 'mariadb://root@localhost:3306/mysql',
56
56
  type: 'mariadb',
57
57
  ttl: 1,
58
- limit: 1,
58
+ cleanupLimit: 1,
59
59
  };
60
60
 
61
61
  const dbs = [
package/src/db/sql/sql.js CHANGED
@@ -39,14 +39,14 @@ class Sql {
39
39
  this.indexRepository = this.connection.getRepository(JacksonIndex);
40
40
  this.ttlRepository = this.connection.getRepository(JacksonTTL);
41
41
 
42
- if (options.ttl && options.limit) {
42
+ if (options.ttl && options.cleanupLimit) {
43
43
  this.ttlCleanup = async () => {
44
44
  const now = Date.now();
45
45
 
46
46
  while (true) {
47
47
  const ids = await this.ttlRepository
48
48
  .createQueryBuilder('jackson_ttl')
49
- .limit(options.limit)
49
+ .limit(options.cleanupLimit)
50
50
  .where('jackson_ttl.expiresAt <= :expiresAt', { expiresAt: now })
51
51
  .getMany();
52
52
 
@@ -68,7 +68,7 @@ class Sql {
68
68
  this.timerId = setTimeout(this.ttlCleanup, options.ttl * 1000);
69
69
  } else {
70
70
  console.log(
71
- 'Warning: ttl cleanup not enabled, set both "ttl" and "limit" options to enable it!'
71
+ 'Warning: ttl cleanup not enabled, set both "ttl" and "cleanupLimit" options to enable it!'
72
72
  );
73
73
  }
74
74
 
package/src/index.js CHANGED
@@ -22,7 +22,7 @@ const defaultOpts = (opts) => {
22
22
  newOpts.db.url || 'postgresql://postgres:postgres@localhost:5432/postgres';
23
23
  newOpts.db.type = newOpts.db.type || 'postgres'; // Only needed if DB_ENGINE is sql. Supported values: postgres, cockroachdb, mysql, mariadb
24
24
  newOpts.db.ttl = (newOpts.db.ttl || 300) * 1; // TTL for the code, session and token stores (in seconds)
25
- newOpts.db.limit = (newOpts.db.limit || 1000) * 1; // Limit ttl cleanup to this many items at a time
25
+ newOpts.db.cleanupLimit = (newOpts.db.cleanupLimit || 1000) * 1; // Limit cleanup of TTL entries to this many items at a time
26
26
 
27
27
  return newOpts;
28
28
  };
@@ -56,7 +56,8 @@ module.exports = async function (opts) {
56
56
  }
57
57
  }
58
58
 
59
- const type = opts.db.engine === 'sql' && opts.db.type ? ' Type: ' + opts.db.type : '';
59
+ const type =
60
+ opts.db.engine === 'sql' && opts.db.type ? ' Type: ' + opts.db.type : '';
60
61
  console.log(`Using engine: ${opts.db.engine}.${type}`);
61
62
 
62
63
  return {