Skip to content
mrmarbles edited this page May 14, 2011 · 14 revisions

Welcome to the komainu wiki!

Installation

npm install komainu

Security in 30 Seconds

With Connect;

var connect = require('connect'),
  komainu = require('komainu');

  var sp = komainu.createSecurityProvider();
  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 = komainu.createSecurityProvider();
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);
Clone this wiki locally