1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 10:19:30 +02:00

use security handler instead of express middleware for access token validation.

This commit is contained in:
Vishal Banthia 2015-12-03 17:33:53 +09:00
parent f10ae51b53
commit 221bc78e49
5 changed files with 120 additions and 81 deletions

View file

@ -7,8 +7,6 @@ var cookieSession = require('cookie-session')
var logger = require('../../util/logger')
var auth = require('./middleware/auth')
module.exports = function(options) {
var log = logger.createLogger('api')
, app = express()
@ -25,17 +23,19 @@ module.exports = function(options) {
swaggerExpress.register(app);
})
// Adding options in request, so that swagger controller
// can use it.
app.use(function(req, res, next) {
req.options = options
next()
})
// TODO: Remove this once frontend is stateless
app.use(cookieSession({
name: options.ssid
, keys: [options.secret]
}))
app.use(auth({
secret: options.secret
, authUrl: options.authUrl
}))
server.listen(options.port)
log.info('Listening on port %d', options.port)
}