diff --git a/server/app.js b/server/app.js index 49decbe..bbdcdf1 100755 --- a/server/app.js +++ b/server/app.js @@ -13,7 +13,6 @@ try { o_.merge(global, require('./settings.local')); } catch(e) {} //app.set('env', 'development'); app.use(require('method-override')()); -app.use(require('cookie-parser')()); app.use(bodyParser.json()); app.use(bodyParser.urlencoded()); var mw = require('./middleware/im')({ diff --git a/server/dev/app.js b/server/dev/app.js index 5259093..fd5bcf5 100644 --- a/server/dev/app.js +++ b/server/dev/app.js @@ -1,5 +1,3 @@ -var cookie = require('cookie'); - module.exports = function(route, app) { app.get(route+'/', function(req, res) { res.render('chat', { diff --git a/server/libs/authentication/default/index.js b/server/libs/authentication/default/index.js index cdeb26c..d7672c0 100644 --- a/server/libs/authentication/default/index.js +++ b/server/libs/authentication/default/index.js @@ -1,15 +1,14 @@ var o_ = require('../../utils'); -// Cookie that stores the session ID -// Will be set as request.sessionID in `authenticate` and `friends` functions -exports.cookie = 'sessionid'; - exports.authenticate = function(request, callback, hub) { // Verify user based on request. // On failure, redirect user to auth form - + var username = request.from; + if (!username) { + username = 'username' + (++hub.uid); + } callback({ - username: 'username' + (++hub.uid), + username: username, displayname: 'John Smith', otherinfo: 'any other relevant key/values' }); diff --git a/server/middleware/im.js b/server/middleware/im.js index c87c7db..f53fe8c 100644 --- a/server/middleware/im.js +++ b/server/middleware/im.js @@ -10,27 +10,7 @@ module.exports = function setupHub(options) { return {hub: store, session: function session(req, res, next) { req.sessionStore = store; - if(!req.cookies) { - next(new Error('session requires cookieParser to work properly')); - return; - } - - // move "fake" cookies from query or body (for JSONP) - if (!(options.authentication.cookie in req.cookies)) { - if (req.param(options.authentication.cookie)) { - req.cookies[options.authentication.cookie] = req.param(options.authentication.cookie); - } - } - - // move "fake" cookies from query or body (for JSONP) - if (!('callback' in req.cookies)) { - if (req.param('callback')) { - req.cookies['callback'] = req.param('callback'); - } - } - - req.sessionID = req.cookies[options.authentication.cookie]; - req.jsonpCallback = req.cookies.callback; + req.sessionID = req.param('sessionid'); if(url.parse(req.url).pathname.substring(0, 5) !== '/app/') { next(); diff --git a/server/settings.js b/server/settings.js index 621737e..baf417b 100644 --- a/server/settings.js +++ b/server/settings.js @@ -1,8 +1,7 @@ // == Server Configuration == // // This is the configuration file for the Node.js Ajax IM server. Here, you -// can set which ports will be used for the public and internal servers, -// as well as other settings such as the session cookie name and expiration. +// can set which ports will be used for the public and internal servers. // === Host and Port === //