middleware

package
v0.0.0-...-b710899 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JSONMimeType       = "application/json"
	FormDataMimeType   = "multipart/form-data"
	URLEncodedMimeType = "application/x-www-form-urlencoded"
)
View Source
const BodyDumpLimit = 1000
View Source
const BodyStoreKey = "body_backup"

Variables

This section is empty.

Functions

func AddRequestId

func AddRequestId(next echo.HandlerFunc) echo.HandlerFunc

Adds the request Id to the general context for use by pulp_client, candlepin_client, and general passing to Doa Layer Note that Lecho already adds it to the logger via the lecho middleware

func CreateMetricsMiddleware

func CreateMetricsMiddleware(metrics *instrumentation.Metrics) echo.MiddlewareFunc

func EnforceConsistentOrgId

func EnforceConsistentOrgId(next echo.HandlerFunc) echo.HandlerFunc

EnforceConsistentOrgId middleware checks that the user's org ID from identity header matches the org_id in any returned data using a generic approach

func EnforceJSONContentType

func EnforceJSONContentType(next echo.HandlerFunc) echo.HandlerFunc

func EnforceOrgId

func EnforceOrgId(next echo.HandlerFunc) echo.HandlerFunc

func ExtractStatus

func ExtractStatus(next echo.HandlerFunc) echo.HandlerFunc

ExtractStatus is a middlware that sets the response status

based on the error returned.  This is meant to be used
with our own fork of lecho to figure out the proper logging level
based on the Error contained within.

func LogServerErrorRequest

func LogServerErrorRequest(next echo.HandlerFunc) echo.HandlerFunc

func MatchedRoute

func MatchedRoute(ctx echo.Context) string

See: https://github.com/labstack/echo/pull/1502/files This method exist for v5 echo framework

func MetricsMiddlewareWithConfig

func MetricsMiddlewareWithConfig(config *MetricsConfig) echo.MiddlewareFunc

func NewRbac

func NewRbac(rbacConfig Rbac) echo.MiddlewareFunc

func SkipAuth

func SkipAuth(p string) bool

func SkipEnforceConsistentOrgId

func SkipEnforceConsistentOrgId(c echo.Context) bool

func SkipMiddleware

func SkipMiddleware(c echo.Context) bool

func SkipRbac

func SkipRbac(c echo.Context, p string) bool

func WrapMiddlewareWithSkipper

func WrapMiddlewareWithSkipper(m func(http.Handler) http.Handler, skip echo_middleware.Skipper) echo.MiddlewareFunc

WrapMiddleware wraps `func(http.Handler) http.Handler` into `echo.MiddlewareFunc`

Types

type BufferedReadCloser

type BufferedReadCloser struct {
	*bufio.Reader
	io.ReadCloser
}

func (BufferedReadCloser) Close

func (rw BufferedReadCloser) Close() error

func (BufferedReadCloser) Read

func (rw BufferedReadCloser) Read(p []byte) (int, error)

type MetricsConfig

type MetricsConfig struct {
	Skipper echo_middleware.Skipper
	Metrics *instrumentation.Metrics
}

type Rbac

type Rbac struct {
	BaseUrl        string
	Skipper        echo_middleware.Skipper
	RbacClient     rbac.ClientWrapper
	KesselClient   rbac.ClientWrapper
	PermissionsMap *rbac.PermissionsMap
}

Jump to

Keyboard shortcuts

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