Documentation
¶
Index ¶
- Constants
- Variables
- func AuthzMiddleware(ctr *cmk.APIController) func(http.Handler) http.Handler
- func ClientDataMiddleware(signingKeyStorage keyvalue.ReadOnlyStringToBytesStorage, ...) func(http.Handler) http.Handler
- func InjectMultiTenancy() func(http.Handler) http.Handler
- func InjectRequestID() func(http.Handler) http.Handler
- func LoggingMiddleware() func(http.Handler) http.Handler
- func OAPIMiddleware(swagger *openapi3.T) func(next http.Handler) http.Handler
- func PanicRecoveryMiddleware() func(http.Handler) http.Handler
- type RoleGetter
Constants ¶
View Source
const (
// TenantPathParamName is the name of the path parameter used to extract the tenant ID.
TenantPathParamName = "tenant"
)
Variables ¶
View Source
var ( ErrNoClientDataHeader = errors.New("no client data header found") ErrMissingSignatureHeader = errors.New("missing client data signature header") ErrPublicKeyNotFound = errors.New("public key not found or invalid") ErrVerifySignatureFailed = errors.New("failed to verify client data signature") ErrDecodeClientData = errors.New("failed to decode client data from header") ErrTriedToBeSystem = errors.New("attempted to be system") )
View Source
var ErrTenantNotFound = errors.New("tenant not found as path parameter")
ErrTenantNotFound is returned when the tenant ID is not found in the request.
Functions ¶
func AuthzMiddleware ¶
func ClientDataMiddleware ¶
func ClientDataMiddleware( signingKeyStorage keyvalue.ReadOnlyStringToBytesStorage, authContextFields []string, roleGetter RoleGetter, ) func(http.Handler) http.Handler
ClientDataMiddleware extracts client data from headers, verifies, and adds to context
func InjectMultiTenancy ¶
InjectMultiTenancy returns a middleware function that handles multi-tenancy based on path parameter.
func InjectRequestID ¶
InjectRequestID injects a RequestID into the context to be used by other middlewares
func LoggingMiddleware ¶
LoggingMiddleware logs the start and end of each request, along with the duration and status code.
func OAPIMiddleware ¶
OAPIMiddleware validates a Request against the OpenAPI Spec Also registers a decoder for merge-patch+json
Types ¶
Click to show internal directories.
Click to hide internal directories.