middleware

package
v0.0.0-...-17e45d3 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	URI_ROOT   = "/"
	API_PREFIX = "/v1/users"
)
View Source
const (
	EP_LIVENESS  = "/liveness"
	EP_READUNESS = "/readiness"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppMiddleware

type AppMiddleware interface {
	SetupMiddleware(gw *runtime.ServeMux) *http.ServeMux
	LogRequests(next http.Handler) http.Handler
	Authorization(next http.Handler) http.Handler
	CORSProtection(next http.Handler) http.Handler
	ReadinesslivenessProbe(next http.Handler) http.Handler
}

type AuthChecker

type AuthChecker interface {
	CheckAccess(key string) (bool, error)
}

type RequestMiddleware

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

func NewMiddleware

func NewMiddleware(ac AuthChecker, l *logrus.Entry) *RequestMiddleware

func (*RequestMiddleware) Authorization

func (m *RequestMiddleware) Authorization(next http.Handler) http.Handler

Authorization auth for admin section

func (*RequestMiddleware) CORSProtection

func (m *RequestMiddleware) CORSProtection(next http.Handler) http.Handler

CORSProtection performs CORS protection

func (*RequestMiddleware) LogRequests

func (m *RequestMiddleware) LogRequests(next http.Handler) http.Handler

LogRequests print to log URL of each request

func (*RequestMiddleware) ReadinesslivenessProbe

func (m *RequestMiddleware) ReadinesslivenessProbe(next http.Handler) http.Handler

func (*RequestMiddleware) SetupMiddleware

func (m *RequestMiddleware) SetupMiddleware(gw *runtime.ServeMux) *http.ServeMux

Jump to

Keyboard shortcuts

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