Middleware to handle authenticating with S3O
This middleware can parse standard cookies via the cookie package. If wanting to use signed cookies or json cookies, please use the cookie-parser middleware before using the S3O middleware.
If many routes require auth:
var express = require('express');
var app = express();
// Add routes here which don't require auth
var authS3O = require('s3o-middleware');
app.use(authS3O);
// Add routes here which require auth
If only paths within a given directory require auth:
var express = require('express');
var app = express();
var router = express.Router();
var authS3O = require('s3o-middleware');
router.use(authS3O);
app.use('/admin', router);
If specific paths require auth:
var express = require('express');
var app = express();
var router = express.Router();
var authS3O = require('s3o-middleware');
app.get('/', authS3O, router);
app.post('/', authS3O);