Documentation ¶
Index ¶
- func ContextMiddleware(con interface{}, findUserFunc FindUser, config *_conf.Config) func(http.Handler) http.Handler
- func GetUser(ctx context.Context) interface{}
- func JwtToUser(jwtStr string, findUserFunc FindUser, con interface{}, config *_conf.Config) (interface{}, error)
- func LoginRequired(con interface{}, findUserFunc FindUser, conf *config.Config) func(http.Handler) http.Handler
- func SetUser(r *http.Request, user interface{}) *http.Request
- type Error
- type FindUser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextMiddleware ¶
func ContextMiddleware( con interface{}, findUserFunc FindUser, config *_conf.Config, ) func(http.Handler) http.Handler
ContextMiddleware adds the authenticated user to http.Request.Context. if there's the token in the specified header / cookie in config.
func JwtToUser ¶
func JwtToUser( jwtStr string, findUserFunc FindUser, con interface{}, config *_conf.Config, ) (interface{}, error)
JwtToUser converts jwStr to the corresponding user.
Types ¶
Click to show internal directories.
Click to hide internal directories.