Documentation ¶
Index ¶
- Constants
- func AppFromContext(ctx context.Context) model.AppData
- func AppID(logger *slog.Logger, errorPath string, appStorage model.AppStorage) negroni.HandlerFunc
- func HTTPLogger(component string, format string, logParams model.LoggerParams, ...) func(http.Handler) http.Handler
- func NegroniHTTPLogger(component string, format string, logParams model.LoggerParams, ...) negroni.Handler
- func NewCacheDisable() negroni.HandlerFunc
- func NewOriginCheckerWithFunc(f model.OriginCheckFunc) model.OriginChecker
- func RemoveTrailingSlash() negroni.HandlerFunc
- type AppOriginChecker
- type OriginChecker
- func (os *OriginChecker) Add(origin string)
- func (os *OriginChecker) AddCheck(f model.OriginCheckFunc)
- func (os *OriginChecker) AddRawURLs(urls []string)
- func (os *OriginChecker) CheckOrigin(r *http.Request, origin string) bool
- func (os *OriginChecker) Delete(origin string)
- func (os *OriginChecker) DeleteAll()
- func (os *OriginChecker) IsPresent(origin string) bool
- func (os *OriginChecker) Update() error
Constants ¶
const (
// FormKeyAppID is a form key to keep application ID.
FormKeyAppID = "appId"
)
Variables ¶
This section is empty.
Functions ¶
func AppFromContext ¶
AppFromContext returns app data from request conntext.
func AppID ¶
func AppID( logger *slog.Logger, errorPath string, appStorage model.AppStorage, ) negroni.HandlerFunc
AppID gets app id from the request body.
func HTTPLogger ¶ added in v2.10.0
func NegroniHTTPLogger ¶ added in v2.10.0
func NegroniHTTPLogger( component string, format string, logParams model.LoggerParams, httpDetailing model.HTTPDetailing, excludeAuth bool, exclude ...string, ) negroni.Handler
func NewCacheDisable ¶ added in v2.2.19
func NewCacheDisable() negroni.HandlerFunc
func NewOriginCheckerWithFunc ¶
func NewOriginCheckerWithFunc(f model.OriginCheckFunc) model.OriginChecker
NewOriginChecker creates new instance of an OriginChecker.
func RemoveTrailingSlash ¶ added in v2.10.0
func RemoveTrailingSlash() negroni.HandlerFunc
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 ¶
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