papers-lti
Passport-flavored LTI authentication middleware for express.
LTIStrategy
Options :
-
createProvider
:createProvider
is an optional function, which delegate the check of a Tool Consumer's identity to an higher level.This function is assumed to request a database to retrieve the consumer secret based on the consumer key, and call the callback parameter with an LTI provider, or a standard node error in
err
if a system error occured, or a string error if the error is handled at an higher level, and the process is just intended to stop. Use either this function or the hardcoded key / secret. This one gets priority over the hardcoded key / secret.@param {Function} createProvider @param {Object} req @param {Function} callback @param {Object || String} err @param {Object} provider
-
consumerKey
: Hardcoded consumer key. -
consumerSecret
: Hardcoded consumer secret.
Usage
With hardcoded key / secret
var papers = ;var LTIStrategy = ;var strategy = consumerKey: 'testconsumerkey' consumerSecret: 'testconsumersecret' // pass the req object to callback // passReqToCallback: true, // https://github.com/omsmith/ims-lti#nonce-stores // nonceStore: new RedisNonceStore('testconsumerkey', redisClient) { // LTI launch parameters // console.dir(lti); // Perform local authentication if necessary return ;};papers;
With dynamic provider
var papers = ;var lti = ;var LTIStrategy = ;var strategy = { // Lookup your LTI customer in your DB with req's params, and get its secret // Dummy DB lookup DAO; }); papers;
Tests
$ npm test