router
v1.1.1
djinn-ci.com/user/router
Documentation
pkg.go.dev ↗Types
Router
type Router struct {
// contains filtered or unexported fields
}
Router is what registers the UI routes for handling registration, authentication, and general management of a user's account.
New
func New(cfg *config.Server, h web.Handler, mw web.Middleware) *Router
Router.RegisterAPI
func (r *Router) RegisterAPI(prefix string, mux *mux.Router, gates ...web.Gate)
RegisterAPI registers the only API route for a user, which is "/user". This will return the currently authenticated user from the request.
Router.RegisterUI
func (r *Router) RegisterUI(mux *mux.Router, csrf func(http.Handler) http.Handler, _ ...web.Gate)
RegisterUI registers the routes for User authentication, and account management against the given mux.Router. The given http.Handler is used for CSRF protection. None of the given gates are applied to any of the registered routes.