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

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/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.103",
4
4
  "license": "Apache 2.0",
5
5
  "description": "SAML 2.0 service",
6
6
  "main": "src/index.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
@@ -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 {