-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use path-to-regex when looking for pages that match the request
because Web uses regular expressions to specify page routes, the same library must be used to test the curret request URL against the loaded endpoints in order to find a match for the caching module to work with. Fix #51
- Loading branch information
Showing
6 changed files
with
44 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* @module Auth | ||
*/ | ||
var config = require(__dirname + '/../../../config.js'); | ||
var help = require(__dirname + '/../help'); | ||
var log = require(__dirname + '/../log'); | ||
var passport = require('dadi-passport'); | ||
|
||
module.exports = function (server) { | ||
server.app.use(function (req, res, next) { | ||
passport({ | ||
uri: 'http://' + config.get('api.host') + ':' + config.get('api.port'), | ||
credentials: { | ||
clientId: config.get('auth.clientId'), | ||
secret: config.get('auth.secret') | ||
}, | ||
wallet: 'file', | ||
walletOptions: { | ||
path: __dirname + '/token.js' | ||
} | ||
}).then(function (bearerToken) { | ||
return next(); | ||
}) | ||
}) | ||
// if (!output) { | ||
// var err = new Error(); | ||
// var message = 'No token received, invalid credentials.'; | ||
// err.name = 'Authentication'; | ||
// err.message = message; | ||
// err.remoteIp = options.hostname; | ||
// err.remotePort = options.port; | ||
// err.path = options.path; | ||
// return next(err); | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters