middleware

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const RequestIDKey string = "request_id"

Variables

This section is empty.

Functions

func ChainHandlers

func ChainHandlers(handler http.Handler, middlewares ...Middleware) http.Handler

func EnsureValidToken

func EnsureValidToken() func(next http.Handler) http.Handler

EnsureValidToken is a middleware that will check the validity of our JWT.

func LogRequst

func LogRequst(next http.Handler) http.Handler

Types

type BasicAuth

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

func NewBasicAuth

func NewBasicAuth(username, password string) *BasicAuth

func (*BasicAuth) Middleware

func (b *BasicAuth) Middleware(handler http.Handler) http.Handler

type CtxKey

type CtxKey string
const RequestID CtxKey = "request_id"

type CustomClaims

type CustomClaims struct {
	Scope string `json:"scope"`
}

CustomClaims contains custom data we want from the token.

func (CustomClaims) Validate

func (c CustomClaims) Validate(ctx context.Context) error

Validate does nothing for this example, but we need it to satisfy validator.CustomClaims interface.

type Middleware

type Middleware func(http.Handler) http.Handler

Jump to

Keyboard shortcuts

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