Documentation
¶
Index ¶
- Variables
- func HasValidJWT(errHandler http.HandlerFunc) func(next http.Handler) http.Handler
- func JWTIndexIS(index string, value interface{}, errHandler http.HandlerFunc) func(next http.Handler) http.Handler
- func RetrieveJWTFromHTTPHeader(w http.ResponseWriter, r *http.Request, errHandler http.HandlerFunc) (string, map[string]interface{}, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( JWTCtxKey contextkey = "jwt" JWTPayloadCtxKey contextkey = "jwt-payload" )
Functions ¶
func HasValidJWT ¶
HasValidJWT is a middleware that checks if the request contains a valid jwt authorization bearer token.
func JWTIndexIS ¶
func JWTIndexIS(index string, value interface{}, errHandler http.HandlerFunc) func(next http.Handler) http.Handler
JWTIndexIS is a middleware that checks if the decoded jwt payload in the authorization bearer header index matches a particular values.
e.g JWTIndexIS("role", "admin", errHandler)
func RetrieveJWTFromHTTPHeader ¶
func RetrieveJWTFromHTTPHeader(w http.ResponseWriter, r *http.Request, errHandler http.HandlerFunc) (string, map[string]interface{}, error)
RetrieveJWTFromHTTPHeader retrieves the jwt token from the http 'Authorization' header.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.