middleware

package
v0.0.0-...-1f7a423 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: CC0-1.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ACOEnabled

func ACOEnabled(cfg *service.Config) func(next http.Handler) http.Handler

func ConnectionClose

func ConnectionClose(next http.Handler) http.Handler

func GetRespWriter

func GetRespWriter(path string) (fhirResponseWriter, error)

non auth resp writers should return an error on an invalid version

func GetTypeFilterSubquery

func GetTypeFilterSubquery(params []string) (fhir.TypeFilterSubquery, error)

GetTypeFilterSubquery parses the _typeFilter subquery For _tag, it validates each comma-separated token to correctly resolve compound query filters.

func HasSharedExportAccess

func HasSharedExportAccess(cfg *service.Config) func(next http.Handler) http.Handler

func HasSystemTypeTag

func HasSystemTypeTag(subquery fhir.TypeFilterSubquery) bool

func SecurityHeader

func SecurityHeader(next http.Handler) http.Handler

func SetRequestParamsCtx

func SetRequestParamsCtx(ctx context.Context, rp RequestParameters) context.Context

TODO: replace this function else where with line 35

func V1V2DenyControl

func V1V2DenyControl(cfg *service.Config) func(next http.Handler) http.Handler

func ValidateRequestHeaders

func ValidateRequestHeaders(next http.Handler) http.Handler

func ValidateRequestURL

func ValidateRequestURL(next http.Handler) http.Handler

ValidateRequestURL ensure that request matches certain expectations. Any error that it finds will result in a http.StatusBadRequest response. If successful, it populates the request context with RequestParameters that can be used downstream. These paramters can be retrieved by calling RequestParametersFromContext.

func ValidateSharedExportBody

func ValidateSharedExportBody(next http.Handler) http.Handler

TODO: BCDA-10505 validate the request body, headers, etc separate ticket: bcda api checks the aco config several times, we should add this to request context so we don't need to regex+loop each time

func WithSharedExportPayload

func WithSharedExportPayload(parent context.Context, body SharedExportBody) context.Context

Types

type CtxSharedExportPayloadType

type CtxSharedExportPayloadType struct{}

type RateLimitMiddleware

type RateLimitMiddleware struct {
	// contains filtered or unexported fields
}

func NewRateLimitMiddleware

func NewRateLimitMiddleware(config *service.Config, db *sql.DB) RateLimitMiddleware

func (RateLimitMiddleware) CheckConcurrentJobs

func (m RateLimitMiddleware) CheckConcurrentJobs(next http.Handler) http.Handler

type RequestParameters

type RequestParameters struct {
	Since         time.Time
	ResourceTypes []string
	Version       string // e.g. v1, v2
	RequestURL    string
	TypeFilter    fhir.TypeFilterSubquery
}

func GetRequestParamsFromCtx

func GetRequestParamsFromCtx(ctx context.Context) (RequestParameters, bool)

type SharedExportBody

type SharedExportBody struct {
	Since         string   `json:"since"`
	Version       string   `json:"version"`
	ResourceTypes []string `json:"resource_types"`
	PartnerID     string   `json:"partner_id"`
	DataTypes     []string `json:"data_types"`
	MBIs          []string `json:"mbis"`
	SinceDecoded  time.Time
}

TODO: (BCDA-10505) add body validation

func FromContextSharedExportPayload

func FromContextSharedExportPayload(ctx context.Context) (SharedExportBody, bool)

Jump to

Keyboard shortcuts

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