middleware

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultAuthenticationConfig = AuthenticationConfig{
		Skipper:      DefaultSkipper,
		RedirectPath: "/login",
	}
)
View Source
var (
	DefaultCSRFConfig = CSRFConfig{
		Skipper:      DefaultSkipper,
		TokenLength:  32,
		TokenLookup:  "header:" + dojo.HeaderXCSRFToken,
		ContextKey:   "csrf",
		CookieName:   "_csrf",
		CookieMaxAge: 86400,
	}
)
View Source
var (
	DefaultGuestConfig = GuestConfig{
		Skipper:      DefaultSkipper,
		RedirectPath: "/",
	}
)
View Source
var (
	DefaultLoggingConfig = LoggingConfig{
		Skipper: DefaultSkipper,
	}
)

Functions

func Authentication

func Authentication() dojo.MiddlewareFunc

func AuthenticationWithConfig

func AuthenticationWithConfig(config AuthenticationConfig) dojo.MiddlewareFunc

func CSRF

func CSRF() dojo.MiddlewareFunc

func CSRFWithConfig

func CSRFWithConfig(config CSRFConfig) dojo.MiddlewareFunc

func DefaultErrorReporter

func DefaultErrorReporter(ctx dojo.Context, err error) error

func DefaultSkipper

func DefaultSkipper(ctx dojo.Context) bool

func Guest

func Guest() dojo.MiddlewareFunc

func GuestWithConfig

func GuestWithConfig(config GuestConfig) dojo.MiddlewareFunc

func Logging added in v1.0.1

func Logging() dojo.MiddlewareFunc

func LoggingWithConfig added in v1.0.1

func LoggingWithConfig(config LoggingConfig) dojo.MiddlewareFunc

Types

type AuthenticationConfig

type AuthenticationConfig struct {
	Skipper      Skipper
	BeforeFunc   BeforeFunc
	RedirectPath string
}

type BeforeFunc

type BeforeFunc func(ctx dojo.Context)

type CSRFConfig

type CSRFConfig struct {
	Skipper Skipper

	TokenLength uint8 `yaml:"token_length"`

	TokenLookup string `yaml:"token_lookup"`

	ContextKey string `yaml:"context_key"`

	CookieName string `yaml:"cookie_name"`

	CookieMaxAge int `yaml:"cookie_max_age"`
}

type ErrorReporter

type ErrorReporter func(ctx dojo.Context, err error) error

type GuestConfig

type GuestConfig struct {
	Skipper      Skipper
	BeforeFunc   BeforeFunc
	RedirectPath string
}

type LoggingConfig added in v1.0.1

type LoggingConfig struct {
	Skipper Skipper
}

type Skipper

type Skipper func(ctx dojo.Context) bool

Jump to

Keyboard shortcuts

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