middleware

package
v0.0.0-...-a3d249e Latest Latest
Warning

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

Go to latest
Published: May 4, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultSentinelConfig is the default Sentinel middleware config.
	DefaultSentinelConfig = SentinelConfig{
		Skipper:         middleware.DefaultSkipper,
		AllowOrigins:    []string{"*"},
		AllowsAllOrigin: true,
	}
)

Functions

func Sentinel

func Sentinel() echo.MiddlewareFunc

Sentinel returns a Cross-Origin Resource Sharing (Sentinel) middleware. See: https://developer.mozilla.org/en/docs/Web/HTTP/Access_control_Sentinel

func SentinelWithConfig

func SentinelWithConfig(config SentinelConfig) echo.MiddlewareFunc

SentinelWithConfig returns a Sentinel middleware with config. See: `Sentinel()`.

Types

type SentinelConfig

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

	// AllowOrigin defines a list of origins that may access the resource.
	// Optional. Default value []string{"*"}.
	AllowOrigins []string `json:"allow_origins"`
	// AllowsAllOrigin defines all origin should be accept or not
	// Optional. Default false, but if AllowOrigins contains "*", automatically turn this true.
	AllowsAllOrigin      bool             `json:"allows_all_origin"`
	AllowsStrictOrigins  []string         `json:"-"`
	AllowsStrictMatchers []*regexp.Regexp `json:"-"`
}

SentinelConfig defines the config for Sentinel middleware.

Jump to

Keyboard shortcuts

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