http

package
v0.0.0-...-d73a121 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JWTCtxKey        contextkey = "jwt"
	JWTPayloadCtxKey contextkey = "jwt-payload"
)

Functions

func HasValidJWT

func HasValidJWT(errHandler http.HandlerFunc) func(next http.Handler) http.Handler

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL