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 18 package(s)

  1. github.com/MajorMJR/factorio-server-manager/src
  2. github.com/Wombats/wombat-server
  3. github.com/apexskier/httpauth/examples
  4. github.com/arbrown/pao/db
  5. github.com/arbrown/pao/game
  6. github.com/doesntgolf/topiary
  7. github.com/funnythingz/sandbox-go/httpauth
  8. github.com/hailiang/httpauth/examples
  9. github.com/lodygens/fedid
  10. github.com/napsy/httpauth/examples
  11. github.com/timakin/gong/src
  12. github.com/timonv/factorio-server-manager
  13. github.com/topiary-io/topiary
  14. github.com/turnkey-commerce/go-ping-sites
  15. github.com/turnkey-commerce/go-ping-sites/controllers
  16. github.com/turnkey-commerce/go-ping-sites/viewmodels
  17. github.com/turnkey-commerce/httpauth/examples
  18. github.com/zan-xhipe/httpauth/examples

Imports 5 package(s)

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

Test imports 3 package(s)

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