Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handle ¶
type Handle func(rw http.ResponseWriter, req *http.Request, par httprouter.Params) error
Handle is similar to httprouter.Handle, except it returns an error which can be handled separately.
type Module ¶
type Module struct { Auth *users.Module Sessions *session.Module Config *config.Module Router *router.Module DB *db.Module Logger *logger.Module // todo: make these pluggable? DBAuth *databaseauth.Module TokenAuth *tokenauth.Module }
Module users is a largely a wrapper around nagax/users/databaseauth to enable user logins.
func (*Module) ErrorHandler ¶
ErrorHandler to handle auth errors. todo: return more fine-grained error codes.
func (*Module) MustWithAuth ¶
MustWithAuth wraps a Handle function and requires a logged in user. The new handler will authenticate using the auth module, creating another wrapper for the original function to make it compatible with http.HandlerFunc (while ensuring it closes over httprouter.Params).
Click to show internal directories.
Click to hide internal directories.