mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 11:53:23 +02:00
use security handler instead of express middleware for access token validation.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user