middlewares

package
v0.0.0-...-ff63446 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NotAuthenticated = httperrors.NewUnauthorizedError("Authentification Error", "not authenticated")
)

Functions

This section is empty.

Types

type AuthenticationMiddleware

type AuthenticationMiddleware interface {
	Handle(next http.Handler) http.Handler
}

The authentication middleware

func NewAuthenticationMiddleware

func NewAuthenticationMiddleware(sessionService sessionservice.SessionService, logger *zap.Logger) AuthenticationMiddleware

The AuthenticationMiddleware constructor

type JSONController

type JSONController interface {
	// Marshall the response from the JSONHandler and handle HTTPError if needed
	Wrap(handler JSONHandler) func(response http.ResponseWriter, request *http.Request)
}

transform a JSON handler into a standard http.HandlerFunc handle github.com/ditrit/badaas/httperrors.HTTPError and JSON marshaling

func NewJSONController

func NewJSONController(logger *zap.Logger) JSONController

type JSONHandler

type JSONHandler func(w http.ResponseWriter, r *http.Request) (any, httperrors.HTTPError)

This handler return a Marshable object and/or an github.com/ditrit/badaas/services/httperrors.HTTPError

type MiddlewareLogger

type MiddlewareLogger interface {
	// [github.com/gorilla/mux] compatible middleware function
	Handle(next http.Handler) http.Handler
}

Log the requests data

func NewMiddlewareLogger

func NewMiddlewareLogger(
	logger *zap.Logger,
	loggerConfiguration configuration.LoggerConfiguration,
) (MiddlewareLogger, error)

MiddlewareLogger constructor

Jump to

Keyboard shortcuts

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