Documentation ¶
Index ¶
- func GetUserFromContext(ctx context.Context) *model.User
- func Login(r *Router, page html.PageFunc, log *snorkel.Logger, db loginner, ...)
- func Logout(r *Router, page html.PageFunc, log *snorkel.Logger, sd sessionDestroyer)
- func NotFound(page html.PageFunc) http.HandlerFunc
- func RedirectIfAuthenticated(h http.Handler) http.Handler
- func RedirectIfNotAuthenticated(h http.Handler) http.Handler
- func Signup(r *Router, page html.PageFunc, log *snorkel.Logger, db signupper)
- func Static(mux chi.Router)
- type Middleware
- type NewServerOptions
- type Router
- func (r *Router) Get(path string, cb func(props html.PageProps) (Node, error))
- func (r *Router) Group(cb func(r *Router))
- func (r *Router) NotFound(h http.HandlerFunc)
- func (r *Router) Post(path string, cb func(props html.PageProps) (Node, error))
- func (r *Router) Use(middleware func(http.Handler) http.Handler)
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetUserFromContext ¶
GetUserFromContext, which may be nil if the user is not authenticated.
Types ¶
type Middleware ¶
func Authenticate ¶
func Authenticate(redirect bool, sg sessionGetter, db userGetter, log *snorkel.Logger) Middleware
Authenticate checks that there's a user logged in, and otherwise either: - redirects to the login page, - or calls the next handler depending on the passed parameter.
type NewServerOptions ¶
Click to show internal directories.
Click to hide internal directories.