middleware

package
v0.6.9 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authorizer

func Authorizer(e *casbin.Enforcer) func(next http.Handler) http.Handler

Authorizer is a middleware checks whether the user is allowed to perform the request.

Types

type Middleware

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

Middleware represents middleware handlers.

func New

func New(l log.Logger) *Middleware

New returns a new Middleware.

func (*Middleware) HandleCors

func (m *Middleware) HandleCors(next http.Handler) http.Handler

HandleCors handles cors policy

func (*Middleware) Instrument

func (m *Middleware) Instrument(next http.Handler) http.Handler

Instrument is a middleware that wraps the provided http.Handler to observe the request result.

func (*Middleware) Logging

func (m *Middleware) Logging(next http.Handler) http.Handler

Logging logs all requests with its information and the time it took to process

func (*Middleware) RestrictDomain

func (m *Middleware) RestrictDomain(next http.Handler) http.Handler

RestrictDomain checks whether request's remote address was matched a defined host pattern or not.

Jump to

Keyboard shortcuts

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