Skip to content

Latest commit

 

History

History
36 lines (32 loc) · 1.08 KB

README.md

File metadata and controls

36 lines (32 loc) · 1.08 KB

S3O-middleware

Middleware to handle authenticating with S3O

Parsing cookies

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.

Usage example for Express

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);