Documentation ¶
Index ¶
- Variables
- func ClearUser(cs *sessions.CookieStore, r *http.Request, w http.ResponseWriter)
- func NewGetUser(cs *sessions.CookieStore) func(r *http.Request) User
- func SaveUser(cs *sessions.CookieStore, r *http.Request, w http.ResponseWriter, u User)
- type Auth
- func (a *Auth) GET(path string, h func(http.ResponseWriter, *http.Request, httprouter.Params))
- func (a *Auth) HandleFunc(method, path string, h httprouter.Handle)
- func (a *Auth) IsAuthenticated(u User) bool
- func (a *Auth) POST(path string, h func(http.ResponseWriter, *http.Request, httprouter.Params))
- type BasicUser
- type Permission
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ( LoginUrl string ForbiddenURL string ForbiddenHandler http.HandlerFunc )
View Source
var ( // GetUser will be called to collect the user data GetUser func(r *http.Request) User )
View Source
var GuestUser = NewUser()
Functions ¶
func ClearUser ¶
func ClearUser(cs *sessions.CookieStore, r *http.Request, w http.ResponseWriter)
func NewGetUser ¶
func NewGetUser(cs *sessions.CookieStore) func(r *http.Request) User
NewGetUser allows you to generate a function which will retrieve user information from the given session.CookieStore
func SaveUser ¶
func SaveUser(cs *sessions.CookieStore, r *http.Request, w http.ResponseWriter, u User)
Types ¶
type Auth ¶
type Auth struct {
Perm Permission
}
func (*Auth) GET ¶
func (a *Auth) GET(path string, h func(http.ResponseWriter, *http.Request, httprouter.Params))
func (*Auth) HandleFunc ¶
func (a *Auth) HandleFunc(method, path string, h httprouter.Handle)
func (*Auth) IsAuthenticated ¶
func (*Auth) POST ¶
func (a *Auth) POST(path string, h func(http.ResponseWriter, *http.Request, httprouter.Params))
type BasicUser ¶
type BasicUser struct {
// contains filtered or unexported fields
}
func (*BasicUser) Allow ¶
func (u *BasicUser) Allow(p Permission)
func (*BasicUser) Disallow ¶
func (u *BasicUser) Disallow(p Permission)
func (*BasicUser) Permissions ¶
func (u *BasicUser) Permissions() map[Permission]bool
type Permission ¶
type Permission uint8
const ( // GuestPermission will be given to every single user by default GuestPermission Permission = 0 )
type User ¶
type User interface { Permissions() map[Permission]bool Allow(Permission) Disallow(Permission) }
Click to show internal directories.
Click to hide internal directories.