sequelize-authentication
v0.3.0
Published
A connect module for authentication against a database.
Readme
sequelize-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://localhostCredentials 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://localhostCredentials in the headers
authentication(sequelize, { via: 'headers' })curl -d "user=username&password=password" http://localhostHm? So, what's next?
Each request to your server will check
