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 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.
Click to show internal directories.
Click to hide internal directories.