Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddUserMiddleware ¶
func AddUserMiddleware(f func(*http.Request) User) mux.Middleware
Add a user to the request.
func ContextWithUser ¶ added in v1.5.2
ContextWithUser returns a new context with the given user.
func LoginRequiredMiddleware ¶ added in v1.3.0
func LoginRequiredMiddleware(notAuth func(w http.ResponseWriter, r *http.Request)) mux.Middleware
Middleware that only allows users who are authenticated to continue. By default, will call the notAuth function. Configure the AddUserMiddleware to change the default behavior.
Types ¶
type User ¶
type User interface { // Check if the user is authenticated IsAuthenticated() bool // Check if the user is an administator IsAdmin() bool }
Default request user interface.
This interface can be used to check if the user is authenticated and if the user is an administrator.
If you want to use these middlewares, you should implement this interface.
func UserFromContext ¶ added in v1.5.2
Click to show internal directories.
Click to hide internal directories.