sequelize-authentication
v0.1.0sequelize-authentication
A connect module for authentication against a database.
Usage:
var app = express()
, authentication = require('sequelize-authentication')
, Sequelize = require('sequelize')
, sequelize = new Sequelize('database', 'user', 'password')
app.configure(function() {
app.use(authentication(sequelize[, options]))
})
Note: If you are serving static files (e.g. via express.static
), make sure, that authentication is added afterwards.
Options
The second parameter of the authentication
function is an object with options.
via
You can define, where the module will find the credentials.
Credentials in the URL
authentication(sequelize, { via: 'query' })
curl "http://localhost?user=username&password=password"
Credentials in the post body
authentication(sequelize, { via: 'body' })
curl -d "user=username&password=password" http://localhost
Credentials in the params
authentication(sequelize, { via: 'params' })
# works for params in the query
curl "http://localhost?user=username&password=password"
# and for params in the post body
curl -d "user=username&password=password" http://localhost
Credentials in the headers
authentication(sequelize, { via: 'headers' })
curl -d "user=username&password=password" http://localhost
Hm? So, what's next?
Each request to your server will check
npm i [email protected]
Source Code
github.com/sequelize/sequeli...Metadata
- BSD
- Whatever
- Unknown
- released 2/17/2013