middleware

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserKey = contextKey("user")
)

Variables

This section is empty.

Functions

func AccessLogMiddleware

func AccessLogMiddleware(next http.Handler, logger AccessLoggerPort) http.Handler

func Auth added in v0.12.0

func Auth(next http.Handler, params AuthParams) http.Handler

func PrivateRoute added in v0.13.0

func PrivateRoute(endpoint http.Handler, authParams AuthParams) http.Handler

func PublicRoute added in v0.13.0

func PublicRoute(endpoint http.Handler) http.Handler

func RequestIdMiddleware added in v0.12.0

func RequestIdMiddleware(next http.Handler) http.Handler

Types

type AccessLoggerPort

type AccessLoggerPort interface {
	Info(durationMs int, status int, requestPath string, requestMethod string, requestId string, userId string)
}

type AuthParams added in v0.12.0

type AuthParams struct {
	Secret   string
	UserRepo userRepositoryPort
	Logger   loggerPort
}

func NewAuthParams added in v0.12.0

func NewAuthParams(secret string, userRepo userRepositoryPort, logger loggerPort) AuthParams

type User added in v0.12.0

type User struct {
	Id   string
	Name string
}

Jump to

Keyboard shortcuts

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