1
0
mirror of https://github.com/volatiletech/authboss.git synced 2025-01-10 04:17:59 +02:00
authboss/context.go
Aaron a2ffe4f7c4 Add many new files and types.
- Add context.
- Add handler type.
- Add new storers for client storage and sessions.
- Add start of remember module.
2015-01-10 22:54:31 -08:00

27 lines
602 B
Go

package authboss
// Context provides context for module operations and callbacks. One obvious
// need for context is a request's session store. It is not safe for use by
// multiple goroutines.
type Context struct {
ClientStorer ClientStorer
User Attributes
keyValues map[string]interface{}
}
func NewContext() *Context {
return &Context{
keyValues: make(map[string]interface{}),
}
}
func (c *Context) Put(key string, thing interface{}) {
c.keyValues[key] = thing
}
func (c *Context) Get(key string) (thing interface{}, ok bool) {
thing, ok = c.keyValues[key]
return thing, ok
}