Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/martindale/passport-bitauth
BitAuth authentication strategy for PassportJS.
https://github.com/martindale/passport-bitauth
Last synced: 10 days ago
JSON representation
BitAuth authentication strategy for PassportJS.
- Host: GitHub
- URL: https://github.com/martindale/passport-bitauth
- Owner: martindale
- License: mit
- Created: 2014-06-26T19:13:44.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-06-26T20:27:33.000Z (over 10 years ago)
- Last Synced: 2024-10-06T03:08:48.138Z (about 1 month ago)
- Language: JavaScript
- Size: 137 KB
- Stars: 11
- Watchers: 6
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
passport-bitauth
================BitAuth authentication strategy for PassportJS.
**Please note!** This _authenticates_ the request, it does **not** _authorize_ it. You should think about how your application's permission structure is organized; there is a different between a user and _a user who is permitted to perform an action_.
# Use
```javascript
// assuming you have an express application...
// if not: `var app = require('express')();`// include the auth strategy
var BitAuthStrategy = require('../lib').Strategy;// an example datastore
// in production, this is likely a real database
var users = {
'Tf7UNQnxB8SccfoyZScQmb34V2GdEtQkzDz': {
name: 'Alice',
sin: 'Tf7UNQnxB8SccfoyZScQmb34V2GdEtQkzDz'
},
'Tf22EUFxHWh4wmA3sDuw151W5C5g32jgph2': {
name: 'Bob',
sin: 'Tf22EUFxHWh4wmA3sDuw151W5C5g32jgph2'
}
}passport.use(new BitAuthStrategy(
function(sin, done) {
if (!users[ sin ]) { return done( null , false ); }
return done( null , users[ sin ] );
}
));app.use( passport.initialize() );
app.get( '/authenticated-endpoint', passport.authenticate('bitauth'), function(req, res, next) {
res.send('this request has been authenticated!');
});
```