middlewares

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JwtTokenAuth

func JwtTokenAuth(sec Secure) func(next http.Handler) http.Handler

func NewRequestLogger

func NewRequestLogger() func(next http.Handler) http.Handler

func RequestID

func RequestID(next http.Handler) http.Handler

Types

type RequestLogger

type RequestLogger struct{}

func (RequestLogger) NewLogEntry

func (RequestLogger) NewLogEntry(r *http.Request) middleware.LogEntry

NewLogEntry creates an alternative log entry which is stored in the context with the key middleware.LogEntryCtxKey. This log entry is used inside chi's own middlewares: Recoverer, e.g.

The new log entry has some new fields which aren't really needed in handlers although could be used in the future.

type Secure

type Secure interface {
	VerifyToken(tokenString string) (string, error)
}

type StructuredLoggerEntry

type StructuredLoggerEntry struct {
	Logger *logrus.Entry
}

func (*StructuredLoggerEntry) Panic

func (l *StructuredLoggerEntry) Panic(v interface{}, stack []byte)

func (*StructuredLoggerEntry) Write

func (l *StructuredLoggerEntry) Write(status, bytes int, header http.Header,
	elapsed time.Duration, extra interface{})

Jump to

Keyboard shortcuts

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