mw

package
v0.0.0-...-aa959bc Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BCryptAPIKey

func BCryptAPIKey(keys map[string]string) echo.MiddlewareFunc

BCryptAPIKey returns a BCryptAPIKey middleware.

func BCryptAPIKeyWithConfig

func BCryptAPIKeyWithConfig(config BCryptAPIKeyConfig) echo.MiddlewareFunc

BCryptAPIKeyWithConfig returns a BCryptAPIKey middleware with config. See `Middleware()`.

func CasbinEnforcer

func CasbinEnforcer(ce *casbin.Enforcer, g ...func(echo.Context) interface{}) echo.MiddlewareFunc

CasbinEnforcer returns a CasbinEnforcer middleware.

For successful policy evaluation it calls the next handler. For failed evaluation, it sends "403 - Fobidden" response.

func CasbinEnforcerWithConfig

func CasbinEnforcerWithConfig(config CasbinEnforcerConfig) echo.MiddlewareFunc

CasbinEnforcerWithConfig returns a CasbinEnforcer middleware with config. See `Middleware()`.

func Logrus

func Logrus() echo.MiddlewareFunc

func LogrusBodyLogger

func LogrusBodyLogger(l logrus.FieldLogger) func(c echo.Context, reqB []byte, resB []byte)

func LogrusWithConfig

func LogrusWithConfig(config LogrusConfig) echo.MiddlewareFunc

func OperationResolver

func OperationResolver(kind string) echo.MiddlewareFunc

OperationResolver returns a OperationResolver middleware.

func OperationResolverWithConfig

func OperationResolverWithConfig(config OperationResolverConfig) echo.MiddlewareFunc

OperationResolverWithConfig returns a OperationResolver middleware with config. See `Middleware()`.

func ValueFromContext

func ValueFromContext(key string) func(echo.Context) interface{}

ValueFromContext get value from echo.Context

Types

type BCryptAPIKeyConfig

type BCryptAPIKeyConfig struct {
	// Skipper defines a function to skip middleware.
	Skipper middleware.Skipper

	// Keys system - hashed key pairs to check against
	Keys map[string]string

	// ClientHeader header that carries system name
	ClientHeader string

	// KeyHeader header that carries system key
	KeyHeader string

	// ContextKey key to output client if authenticated
	ContextKey string
}

BCryptAPIKeyConfig defines the config for BCryptAPIKey middleware.

type CasbinEnforcerConfig

type CasbinEnforcerConfig struct {
	// Skipper defines a function to skip middleware.
	Skipper middleware.Skipper

	// Enforcer policy engine
	// Required.
	Enforcer *casbin.Enforcer

	// ParamGetters functions to source parameters for Casbin evaluation
	ParamGetters []func(echo.Context) interface{}
}

CasbinEnforcerConfig defines the config for CasbinEnforcer middleware.

type LogrusConfig

type LogrusConfig struct {
	// Skipper defines a function to skip middleware.
	Skipper middleware.Skipper

	Logger logrus.FieldLogger
}

LogrusConfig defines the config for Logrus middleware.

type OperationResolverConfig

type OperationResolverConfig struct {
	// Skipper defines a function to skip middleware.
	Skipper middleware.Skipper

	// ContextKey key to output client if authenticated
	ContextKey string

	// Kind switches operation resolution logic. Supported: "soap"
	Kind string
}

OperationResolverConfig defines the config for OperationResolver middleware.

Jump to

Keyboard shortcuts

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