top

Package httpauth implements cookie/session based authentication and authorization. Intended for use with the net/http or github.com/gorilla/mux packages, but may work with github.com/codegangsta/martini as well. Credentials are stored as a username + password hash, computed with bcrypt.

Three user storage systems are currently implemented: file based (encoding/gob), sql databases (database/sql), and MongoDB databases.

Access can be restricted by a users' role. A higher role will give more access.

Users can be redirected to the page that triggered an authentication error.

Messages describing the reason a user could not authenticate are saved in a cookie, and can be accessed with the Messages function.

Example source can be found at https://github.com/apexskier/httpauth/blob/master/examples/server.go

Imported by 1 package(s)

  1. github.com/anoopengineer/httpauth/examples

Imports 5 package(s)

  1. github.com/syndtr/goleveldb/leveldb
  2. gopkg.in/mgo.v2/bson
  3. github.com/gorilla/sessions
  4. golang.org/x/crypto/bcrypt
  5. gopkg.in/mgo.v2

Test imports 3 package(s)

  1. github.com/lib/pq
  2. github.com/mattn/go-sqlite3
  3. github.com/go-sql-driver/mysql