Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/runk/node-wst
wstrust middleware
https://github.com/runk/node-wst
Last synced: about 1 month ago
JSON representation
wstrust middleware
- Host: GitHub
- URL: https://github.com/runk/node-wst
- Owner: runk
- License: mit
- Created: 2014-04-28T23:56:01.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-05-15T22:58:00.000Z (over 10 years ago)
- Last Synced: 2024-04-25T00:56:06.531Z (8 months ago)
- Language: JavaScript
- Size: 203 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
node-wst
========Dumb easy WS-Trust expressjs/connect middleware
## Installation
npm i wst
## Usage
var wst = require('wst');
var opts = {
ttl: 86400,
secret: 's3cr3t' // long secret string
};
function authorize(credentials, cb) {
if (credentials.username == 'bob' && credentials.password == 'secret')
return cb(null, {userId: 1});
cb(null, null);
}// app = express();
app.post('/auth/token', wst.auth(opts, authorize));
app.post('/make/me/happy', wst.check(opts), function(req, res, next) {
res.send('success');
});