0.0.12 • Published 4 years ago

express-shield v0.0.12

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago
 _____                                   ____  _     _      _     _
| ____|_  ___ __  _ __ ___  ___ ___     / ___|| |__ (_) ___| | __| |
|  _| \ \/ / '_ \| '__/ _ \/ __/ __|____\___ \| '_ \| |/ _ \ |/ _` |
| |___ >  <| |_) | | |  __/\__ \__ \_____|__) | | | | |  __/ | (_| |
|_____/_/\_\ .__/|_|  \___||___/___/    |____/|_| |_|_|\___|_|\__,_|
           |_|

Clean, simple OAuth2.0 with out-of-the-package support for Express

Installation

npm install express-shield or yarn add express-shield

Express

const ExpressShield = require('express-shield').Express
const model = require('./model')
const shield = new ExpressShield({model})

...

app.use('/oauth/authorize', shield.authorize({
  authenticateHandler: {
    handle: (req,res) => {
      // Get User from request
      return myUser
    }
  }
}))
app.use('oauth/token', shield.token())

// Routes shielded by OAuth2.0
app.use('/secure/route', shield.authenticate())
app.use('/another/secure/route', shield.authenticate())

And that's it. Really.

See example/express for a real, working example of this

Model

More coming soon.

See example/model.js for a concrete, working example

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago