0.0.22 • Published 3 years ago

@thetechcompany/express-shield v0.0.22

Weekly downloads
-
License
MIT
Repository
github
Last release
3 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.20

3 years ago

0.0.21

3 years ago

0.0.22

3 years ago

0.0.19

3 years ago

0.0.18

3 years ago

0.0.17

3 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago