middleware

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: MIT Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// UserAgentKey is the key of pair for the user agent stored in the context map
	UserAgentKey = "userAgent"

	// UserIpKey is the key of pair for the user ip stored in the context map
	UserIpKey = "userIp"
)
View Source
const UserAddressKey = "userAddress"

UserAddressKey is the key of pair for the user address stored in the context map

Variables

View Source
var ErrContentLengthTooLarge = errors.New("content length too large")

ErrContentLengthTooLarge signals the content length is too large

View Source
var ErrInvalidPath = errors.New("invalid path")

ErrInvalidPath signals that the path is invalid

View Source
var ErrMalformedToken = errors.New("malformed token")

ErrMalformedToken signals that a malformed token has been provided

View Source
var ErrUnknownContentLength = errors.New("unknown content length")

ErrUnknownContentLength signals that the content length is unknown

Functions

func NewContentLengthLimiter added in v1.0.15

func NewContentLengthLimiter(apiPackages map[string]config.APIPackageConfig) (*contentLengthLimiter, error)

NewContentLengthLimiter will abort all requests that have Content-Length size bigger than the one specified in config.

func NewMetricsMiddleware

func NewMetricsMiddleware(
	statusMetricsHandler core.StatusMetricsHandler,
	conf config.ApiRoutesConfig,
) (*metricsMiddleware, error)

NewMetricsMiddleware returns a new instance of metricsMiddleware

func NewNativeAuth

func NewNativeAuth(args ArgNativeAuth) (*nativeAuth, error)

NewNativeAuth returns a new instance of nativeAuth

func NewNativeAuthWhitelistHandler

func NewNativeAuthWhitelistHandler(apiPackages map[string]config.APIPackageConfig) *nativeAuthWhitelistHandler

NewNativeAuthWhitelistHandler returns a new instance of nativeAuthWhitelistHandler

func NewUserContext

func NewUserContext() *userContext

NewUserContext returns a new instance of userContext

Types

type ArgNativeAuth

type ArgNativeAuth struct {
	Validator        authentication.AuthServer
	TokenHandler     authentication.AuthTokenHandler
	WhitelistHandler core.NativeAuthWhitelistHandler
}

Jump to

Keyboard shortcuts

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