middleware

package
v1.0.19 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: MIT Imports: 15 Imported by: 0

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