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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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