0.3.0 • Published 11 years ago

sequelize-authentication v0.3.0

Weekly downloads
3
License
-
Repository
github
Last release
11 years ago

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://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

0.3.0

11 years ago

0.2.0

11 years ago

0.1.0

11 years ago