Documentation ¶
Index ¶
- Constants
- func Generic401(w http.ResponseWriter, r *http.Request, c *Context) error
- func Generic403(w http.ResponseWriter, r *http.Request, c *Context) error
- func ObjectIdHex(id bson.ObjectId) string
- func ParseTemplates(name, path string, funcs template.FuncMap, delims []string) *template.Template
- func ResetPassword(token, password string, c *Context) error
- type Config
- type Context
- type Goat
- func (g *Goat) CloneDB() *mgo.Database
- func (g *Goat) Close()
- func (g *Goat) CopyDB() *mgo.Database
- func (g *Goat) ListenAndServe(port string) error
- func (g *Goat) ListenAndServeTLS(cert, key, addr string) error
- func (g *Goat) NewDatabaseMiddleware(host, name string) Middleware
- func (g *Goat) NewSessionMiddleware(storename string) Middleware
- func (g *Goat) RegisterMiddleware(m Middleware)
- func (g *Goat) RegisterRoute(path, name string, method int, handler interface{})
- func (g *Goat) RegisterStaticFileHandler(remote, local string)
- func (g *Goat) Reverse(root string, params ...string) (*url.URL, error)
- type Handler
- type Interceptor
- type Middleware
- type ResetToken
- type User
Constants ¶
View Source
const ( GET = 1 << 0 POST = 1 << 1 PUT = 1 << 2 DELETE = 1 << 3 )
Variables ¶
This section is empty.
Functions ¶
func Generic401 ¶
func Generic403 ¶
func ObjectIdHex ¶
func ParseTemplates ¶
func ResetPassword ¶
Types ¶
type Context ¶
func NewContext ¶
func (*Context) ClearSession ¶
func (c *Context) ClearSession(w http.ResponseWriter, r *http.Request)
type Goat ¶
func (*Goat) ListenAndServe ¶
func (*Goat) ListenAndServeTLS ¶
func (*Goat) NewDatabaseMiddleware ¶
func (g *Goat) NewDatabaseMiddleware(host, name string) Middleware
func (*Goat) NewSessionMiddleware ¶
func (g *Goat) NewSessionMiddleware(storename string) Middleware
func (*Goat) RegisterMiddleware ¶
func (g *Goat) RegisterMiddleware(m Middleware)
func (*Goat) RegisterRoute ¶
func (*Goat) RegisterStaticFileHandler ¶
type Interceptor ¶
func NewAuthSessionInterceptor ¶
func NewAuthSessionInterceptor(normal, unauthorized Handler) Interceptor
func NewBasicAuthInterceptor ¶
func NewBasicAuthInterceptor(normal Handler) Interceptor
type ResetToken ¶
func RequestResetToken ¶
func RequestResetToken(username string, c *Context) (*ResetToken, error)
Fetches a request token for the user. If the user is found, they will be added to the provided context.
func (*ResetToken) Delete ¶
func (r *ResetToken) Delete(c *Context) error
func (*ResetToken) Save ¶
func (r *ResetToken) Save(c *Context) error
type User ¶
type User struct { Id bson.ObjectId `json:"-" bson:"_id,omitempty"` Username string `json:"username,omitempty" bson:"username,omitempty"` Password []byte `json:"-" bson:"password,omitempty"` Values map[string]interface{} `json:"values,omitempty" bson:"values,omitempty"` }
func Authenticate ¶
Login validates and returns a user object if they exist in the database.
func (*User) SetPassword ¶
SetPassword takes a plaintext password and hashes it with bcrypt and sets the password field to the hash.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.