middleware

package
v0.0.0-...-ef901e4 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAuthRejection : auth rejection
	ErrAuthRejection = domain.NewErrorWithCode("dsps.auth.rejected")
)

Functions

func DefaultHeadersMiddleware

func DefaultHeadersMiddleware(deps DefaultHeadersDependency) router.MiddlewareFunc

DefaultHeadersMiddleware is middleware to set some headers by default

func GetRealIP

func GetRealIP(deps RealIPDependency, r router.Request) string

GetRealIP returns end-user IP address information if available. If not available, returns ""

func LoggingMiddleware

func LoggingMiddleware(realIPDeps RealIPDependency, tracingDeps TracingDependency) router.MiddlewareFunc

LoggingMiddleware is middleware for logging

func NewAdminAuth

func NewAdminAuth(mainCtx context.Context, deps AdminAuthDependency) router.MiddlewareFunc

NewAdminAuth creates middleware for authentication

func NewNormalAuth

NewNormalAuth creates middleware for authentication

func RealIPMiddleware

func RealIPMiddleware(deps RealIPDependency) router.MiddlewareFunc

RealIPMiddleware initialize middleware for real IP handling. Because "github.com/natureglobal/realip" is http.Handler middleware, this method wraps http.Handler

func SentryMiddleware

func SentryMiddleware(deps SentryDependency) router.MiddlewareFunc

SentryMiddleware traces incoming HTTP request/response

func TracingMiddleware

func TracingMiddleware(realIPDeps RealIPDependency, deps TracingDependency) router.MiddlewareFunc

TracingMiddleware traces incoming HTTP request/response

Types

type AdminAuthDependency

type AdminAuthDependency interface {
	RealIPDependency
	GetAdminAuthConfig() *config.AdminAuthConfig
}

AdminAuthDependency is to inject required objects to the middleware

type DefaultHeadersDependency

type DefaultHeadersDependency interface {
	GetDefaultHeaders() map[string]string
}

DefaultHeadersDependency is to inject required objects to the middleware

type NormalAuthDependency

type NormalAuthDependency interface {
	GetStorage() domain.Storage
	DiscloseAuthRejectionDetail() bool
}

NormalAuthDependency is to inject required objects to the middleware

type RealIPDependency

type RealIPDependency interface {
	// If empty, RealIPMiddleware does nothing.
	GetIPHeaderName() string
	GetTrustedProxyRanges() []domain.CIDR
}

RealIPDependency is to inject required objects to the middleware

type SentryDependency

type SentryDependency interface {
	GetSentry() sentry.Sentry
}

SentryDependency is to inject required objects to the middleware

type TracingDependency

type TracingDependency interface {
	GetTelemetry() *telemetry.Telemetry
}

TracingDependency is to inject required objects to the middleware

Jump to

Keyboard shortcuts

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