Comparing version 1.0.5 to 1.0.6
@@ -76,3 +76,3 @@ const Validator = require('./Validator'); | ||
// include redirectToAfterLaunch as the 'next' url | ||
return res.redirect(`${config.launchPath}?next=${redirectToAfterLaunch}`); | ||
return res.redirect(`${launchPath}?next=${redirectToAfterLaunch}`); | ||
} | ||
@@ -79,0 +79,0 @@ // Not authorizing on launch. Redirect to redirectToAfterLaunch |
{ | ||
"name": "caccl-lti", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "LTI launch validator for IMS-LTI standard launches.", | ||
@@ -8,3 +8,3 @@ "main": "index.js", | ||
"test": "mocha --exit", | ||
"ltitest": "node ./test/lti/spinUpServer.js" | ||
"selenium": "node ./node_modules/dce-selenium/run" | ||
}, | ||
@@ -42,8 +42,10 @@ "repository": { | ||
"chai-as-promised": "^7.1.1", | ||
"eslint": "^5.12.0", | ||
"dce-selenium": "^1.0.18", | ||
"eslint": "^5.13.0", | ||
"eslint-config-airbnb": "^17.1.0", | ||
"eslint-plugin-import": "^2.14.0", | ||
"eslint-plugin-jsx-a11y": "^6.1.2", | ||
"eslint-plugin-react": "^7.12.3", | ||
"eslint-plugin-import": "^2.16.0", | ||
"eslint-plugin-jsx-a11y": "^6.2.1", | ||
"eslint-plugin-react": "^7.12.4", | ||
"express": "^4.16.4", | ||
"express-session": "^1.15.6", | ||
"fs": "0.0.1-security", | ||
@@ -50,0 +52,0 @@ "https": "^1.0.0", |
@@ -8,3 +8,8 @@ { | ||
"func-names": ["error","never"] | ||
}, | ||
"globals": { | ||
"itS": false, | ||
"describeS": false, | ||
"driver": false | ||
} | ||
} |
const chai = require('chai'); | ||
const clone = require('fast-clone'); | ||
const chaiAsPromised = require('chai-as-promised'); | ||
@@ -12,18 +13,2 @@ const oauth = require('oauth-signature'); | ||
// const updateAndAddSignature = (examplesPackage, example) => { | ||
// const newExample = example; | ||
// | ||
// newExample.body.oauth_timestamp = Math.ceil(Date.now() / 1000); | ||
// newExample.body.oauth_signature = decodeURIComponent( | ||
// oauth.generate( | ||
// examplesPackage.method, | ||
// examplesPackage.url, | ||
// examplesPackage.body, | ||
// examplesPackage.consumerSecret | ||
// ) | ||
// ); | ||
// | ||
// return newExample; | ||
// }; | ||
describe('Validator', function () { | ||
@@ -37,3 +22,3 @@ it('Accepts valid requests', function () { | ||
valid.examples.forEach((example) => { | ||
const { body } = example; | ||
const body = clone(example.body); | ||
@@ -68,3 +53,3 @@ // Reset timestamp | ||
it('Rejects invalid requests', function () { | ||
it('Rejects invalid requests', async function () { | ||
const validator = new Validator({ | ||
@@ -75,4 +60,5 @@ consumer_key: valid.consumerKey, | ||
valid.examples.forEach((example) => { | ||
const { body } = example; | ||
for (let i = 0; i < valid.examples.length; i++) { | ||
const example = valid.examples[i]; | ||
const body = clone(example.body); | ||
@@ -104,6 +90,11 @@ // Reset timestamp | ||
// eslint-disable-next-line no-unused-expressions | ||
expect(validator.isValid(req)).to.be.rejected; | ||
}); | ||
/* eslint-disable no-await-in-loop */ | ||
try { | ||
await validator.isValid(req); | ||
throw new Error('Validator marked example as valid when it wasnt'); | ||
} catch (err) { | ||
// Good! | ||
} | ||
} | ||
}); | ||
}); |
@@ -96,3 +96,2 @@ const oauth = require('oauth-signature'); | ||
); | ||
return (generatedSignature === req.body.oauth_signature); | ||
@@ -99,0 +98,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
167173
3947
15
0