-
Notifications
You must be signed in to change notification settings - Fork 4
Security in 30 seconds
mrmarbles edited this page May 11, 2011
·
1 revision
With Connect;
var connect = require('connect'),
komainu = require('komainu');
var sp = new komainu.SecurityProvider();
sp.addCredentials('test', 'test', 'LOGGED_IN_USER') // test purposes only
connect.createServer(
connect.cookieParser(),
connect.session({secret:'mySecretKey'}),
sp.secure()
).listen(3000);
With ExpressJS
var express = require('express'),
komainu = require('komainu');
var app = module.exports = express.createServer();
var sp = new komainu.SecurityProvider();
sp.addCredentials('test', 'test', 'LOGGED_IN_USER'); // test purposes only
app.configure(function() {
app.use(express.cookieParser());
app.use(express.session({secret:'mySecretKey'});
app.use(sp.secure());
});
app.listen(3000);