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