@boxyhq/saml-jackson 0.1.5-beta.102 → 0.1.5-beta.106

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.
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Bug report
3
+ about: Report any issues with the platform
4
+ title: ""
5
+ labels: bug
6
+ assignees: ""
7
+ ---
8
+
9
+ Found a bug? Please fill out the sections below. 👍
10
+
11
+ ### Issue Summary
12
+
13
+ A summary of the issue. This needs to be a clear detailed-rich summary.
14
+
15
+ ### Steps to Reproduce
16
+
17
+ 1. (for example) Went to ...
18
+ 2. Clicked on...
19
+ 3. ...
20
+
21
+ Any other relevant information. For example, why do you consider this a bug and what did you expect to happen instead?
22
+
23
+ ### Technical details
24
+
25
+ - Browser version: You can use https://www.whatsmybrowser.org/ to find this out.
26
+ - Node.js version
27
+ - Anything else that you think could be an issue.
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Questions
4
+ url: https://github.com/boxyhq/jackson/discussions
5
+ about: Ask a general question about the project on our GitHub Discussion page
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest a feature or idea
4
+ title: ""
5
+ labels: enhancement
6
+ assignees: ""
7
+ ---
8
+
9
+ > Please check if your Feature Request has not been already raised in the [Discussions Tab](https://github.com/boxyhq/jackson/discussions), as we would like to reduce duplicates. If it has been already raised, simply upvote it 🔼.
10
+
11
+ ### Is your proposal related to a problem?
12
+
13
+ <!--
14
+ Provide a clear and concise description of what the problem is.
15
+ For example, "I'm always frustrated when..."
16
+ -->
17
+
18
+ (Write your answer here.)
19
+
20
+ ### Describe the solution you'd like
21
+
22
+ <!--
23
+ Provide a clear and concise description of what you want to happen.
24
+ -->
25
+
26
+ (Describe your proposed solution here.)
27
+
28
+ ### Describe alternatives you've considered
29
+
30
+ <!--
31
+ Let us know about other solutions you've tried or researched.
32
+ -->
33
+
34
+ (Write your answer here.)
35
+
36
+ ### Additional context
37
+
38
+ <!--
39
+ Is there anything else you can add about the proposal?
40
+ You might want to link to related issues here, if you haven't already.
41
+ -->
42
+
43
+ (Write your answer here.)
@@ -0,0 +1,31 @@
1
+ ## What does this PR do?
2
+
3
+ <!-- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. -->
4
+
5
+ Fixes # (issue)
6
+
7
+ ## Type of change
8
+
9
+ <!-- Please delete options that are not relevant. -->
10
+
11
+ - [ ] Bug fix (non-breaking change which fixes an issue)
12
+ - [ ] New feature (non-breaking change which adds functionality)
13
+ - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
14
+ - [ ] This change requires a documentation update
15
+
16
+ ## How should this be tested?
17
+
18
+ <!-- Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration -->
19
+
20
+ - [ ] Test A
21
+ - [ ] Test B
22
+
23
+ ## Checklist:
24
+
25
+ - [ ] My code follows the style guidelines of this project
26
+ - [ ] I have performed a self-review of my own code and corrected any misspellings
27
+ - [ ] I have commented my code, particularly in hard-to-understand areas
28
+ - [ ] I have made corresponding changes to the documentation
29
+ - [ ] My changes generate no new warnings
30
+ - [ ] I have added tests that prove my fix is effective or that my feature works
31
+ - [ ] New and existing unit tests pass locally with my changes
package/README.md CHANGED
@@ -287,7 +287,8 @@ Please try to create bug reports that are:
287
287
 
288
288
  ## Support
289
289
  Reach out to the maintainer at one of the following places:
290
-
290
+
291
+ - [GitHub Discussions](https://github.com/boxyhq/jackson/discussions)
291
292
  - [GitHub Issues](https://github.com/boxyhq/jackson/issues)
292
293
  - The email which is located [in GitHub profile](https://github.com/deepakprabhakara)
293
294
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boxyhq/saml-jackson",
3
- "version": "0.1.5-beta.102",
3
+ "version": "0.1.5-beta.106",
4
4
  "license": "Apache 2.0",
5
5
  "description": "SAML 2.0 service",
6
6
  "main": "src/index.js",
@@ -17,7 +17,6 @@
17
17
  "scripts": {
18
18
  "start": "cross-env IDP_ENABLED=true node src/jackson.js",
19
19
  "dev": "cross-env IDP_ENABLED=true nodemon src/jackson.js",
20
- "calendso": "cross-env DB_URL=postgresql://postgres:postgres@localhost:5450/calendso nodemon src/jackson.js",
21
20
  "mongo": "cross-env DB_ENGINE=mongo DB_URL=mongodb://localhost:27017/jackson nodemon src/jackson.js",
22
21
  "pre-loaded": "cross-env DB_ENGINE=mem PRE_LOADED_CONFIG='./_config' nodemon src/jackson.js",
23
22
  "test": "tap --timeout=100 src/**/*.test.js",
@@ -115,7 +115,7 @@ const authorize = async (req, res) => {
115
115
  }
116
116
 
117
117
  const samlReq = saml.request({
118
- entityID: samlConfig.idpMetadata.entityID,
118
+ entityID: options.samlAudience,
119
119
  callbackUrl: options.externalUrl + options.samlPath,
120
120
  signingKey: samlConfig.certs.privateKey,
121
121
  });
@@ -196,6 +196,11 @@ const samlResponse = async (req, res) => {
196
196
  }
197
197
 
198
198
  const profile = await saml.validateAsync(rawResponse, validateOpts);
199
+
200
+ // some providers don't return the id in the assertion, we set it to a sha256 hash of the email
201
+ if (profile && profile.claims && !profile.claims.id) {
202
+ profile.claims.id = crypto.createHash('sha256').update(profile.claims.email).digest('hex');
203
+ }
199
204
 
200
205
  // store details against a code
201
206
  const code = crypto.randomBytes(20).toString('hex');
package/src/index.js CHANGED
@@ -19,7 +19,7 @@ const defaultOpts = (opts) => {
19
19
  newOpts.db = newOpts.db || {};
20
20
  newOpts.db.engine = newOpts.db.engine || 'sql'; // Supported values: redis, sql, mongo, mem. Keep comment in sync with db.js
21
21
  newOpts.db.url =
22
- newOpts.db.url || 'postgres://postgres:postgres@localhost:5432/jackson';
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
25
  newOpts.db.limit = (newOpts.db.limit || 1000) * 1; // Limit ttl cleanup to this many items at a time
@@ -56,7 +56,7 @@ module.exports = async function (opts) {
56
56
  }
57
57
  }
58
58
 
59
- const type = opts.db.type ? ' Type: ' + opts.db.type : '';
59
+ const type = opts.db.engine === 'sql' && opts.db.type ? ' Type: ' + opts.db.type : '';
60
60
  console.log(`Using engine: ${opts.db.engine}.${type}`);
61
61
 
62
62
  return {