middleware

package
v2.8.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FormKeyAppID is a form key to keep application ID.
	FormKeyAppID = "appId"
)

Variables

This section is empty.

Functions

func AppFromContext

func AppFromContext(ctx context.Context) model.AppData

AppFromContext returns app data from request conntext.

func AppID

func AppID(errorPath string, appStorage model.AppStorage, logger *log.Logger) negroni.HandlerFunc

AppID gets app id from the request body.

func NewCacheDisable added in v2.2.19

func NewCacheDisable() negroni.HandlerFunc

func NewNegroniLogger

func NewNegroniLogger(name string) *negroni.Logger

func NewOriginCheckerWithFunc

func NewOriginCheckerWithFunc(f model.OriginCheckFunc) model.OriginChecker

NewOriginChecker creates new instance of an OriginChecker.

Types

type AppOriginChecker

type AppOriginChecker struct {
	OriginChecker
	// contains filtered or unexported fields
}

func NewAppOriginChecker

func NewAppOriginChecker(appstorage model.AppStorage) (*AppOriginChecker, error)

NewOriginChecker creates new instance of an OriginChecker.

func (*AppOriginChecker) Update

func (aoc *AppOriginChecker) Update() error

type OriginChecker

type OriginChecker struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

OriginChecker holds user's AllowOriginRequestFunc and checks dynamically added CORS origins from an all app's redirect urls.

func NewOriginChecker

func NewOriginChecker() *OriginChecker

NewOriginChecker creates new instance of an OriginChecker.

func (*OriginChecker) Add

func (os *OriginChecker) Add(origin string)

Add adds origin to the list of allowed origins.

func (*OriginChecker) AddCheck

func (os *OriginChecker) AddCheck(f model.OriginCheckFunc)

With adds AllowOriginRequestFunc to list of checks.

func (*OriginChecker) AddRawURLs

func (os *OriginChecker) AddRawURLs(urls []string)

AddRawURLs parses and adds urls to the list of allowed origins.

func (*OriginChecker) CheckOrigin

func (os *OriginChecker) CheckOrigin(r *http.Request, origin string) bool

CheckOrigin is a custom func for validate origin, checking it with all AllowOriginRequestFuncs, including user's provided func.

func (*OriginChecker) Delete

func (os *OriginChecker) Delete(origin string)

Delete removes origin from the list of allowed origins.

func (*OriginChecker) DeleteAll

func (os *OriginChecker) DeleteAll()

DeleteAll removes all origins from the global origin map.

func (*OriginChecker) IsPresent

func (os *OriginChecker) IsPresent(origin string) bool

IsPresent returns true if the provided origin presented in the origins map, false otherwise.

func (*OriginChecker) Update

func (os *OriginChecker) Update() error

Jump to

Keyboard shortcuts

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