middleware

package
v2.0.6 Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: BSD-2-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowCORS

func AllowCORS() fiber.Handler

func Authorize

func Authorize(cup CurrentUserProvider, isRequired ...bool) fiber.Handler

func ErrorHandler

func ErrorHandler(logger logger.Logger) func(*fiber.Ctx, error) error

func PanicLogger

func PanicLogger() fiber.Handler

func RecoveryWithWriter

func RecoveryWithWriter(out io.Writer) fiber.Handler

RecoveryWithWriter returns a middleware for a given writer that recovers from any panics and writes a 500 if there was one.

func RequireRoles

func RequireRoles(roles ...fmt.Stringer) fiber.Handler

Types

type CurrentUserContext

type CurrentUserContext struct {
	sdkcm.OAuth
	sdkcm.User
}

type CurrentUserProvider

type CurrentUserProvider interface {
	GetCurrentUser(ctx context.Context, oauthID string) (sdkcm.User, error)
	ServiceContext
}

type ServiceContext

type ServiceContext interface {
	Logger(prefix string) logger.Logger
	Get(prefix string) (interface{}, bool)
	MustGet(prefix string) interface{}
}

Jump to

Keyboard shortcuts

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