server

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthHeaderTokenExtractor added in v0.0.6

func AuthHeaderTokenExtractor(r *http.Request) (string, error)

AuthHeaderTokenExtractor is a TokenExtractor that takes a request and extracts the token from the Authorization header.

func CORSOptionsHandleFunc added in v0.0.8

func CORSOptionsHandleFunc(methods string, headers string) func(http.ResponseWriter, *http.Request)

CORSOptionsHandleFunc set CORS headers for the preflight request CORSEnabledFunction is an example of setting CORS headers. For more information about CORS and CORS preflight requests, see https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request.

func Serve

func Serve(path []string, method []string,
	handle []func(http.ResponseWriter, *http.Request), mwf ...mux.MiddlewareFunc)

func ServeJWT added in v0.0.8

func ServeJWT(path []string, method []string,
	handle []func(http.ResponseWriter, *http.Request))

func Vars added in v0.0.4

func Vars(r *http.Request) map[string]string

Types

type JWTClaims added in v0.0.6

type JWTClaims struct {
	Id        string
	IssuedAt  time.Time
	ExpiredAt time.Time
}

func GetClaims added in v0.0.13

func GetClaims(r *http.Request) *JWTClaims

func NewJWTClaims added in v0.0.6

func NewJWTClaims(id string) *JWTClaims

func (*JWTClaims) Valid added in v0.0.6

func (c *JWTClaims) Valid() error

type JWTContextKey added in v0.0.7

type JWTContextKey struct{}

ContextKey is the key used in the request context where the information from a validated JWT will be stored.

type JWTValidator added in v0.0.6

type JWTValidator struct {
	// contains filtered or unexported fields
}

func GetJWTValidator added in v0.0.6

func GetJWTValidator() *JWTValidator

func (*JWTValidator) CheckJWT added in v0.0.6

func (v *JWTValidator) CheckJWT(next http.Handler) http.Handler

func (*JWTValidator) VerifyToken added in v0.0.6

func (v *JWTValidator) VerifyToken(token string) (*JWTClaims, error)

Jump to

Keyboard shortcuts

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