middleware

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowContentType

func AllowContentType(contentTypes ...string) func(next router.Handler) router.Handler

func AllowedHosts

func AllowedHosts(allowed_hosts ...string) func(next router.Handler) router.Handler

Check if the request.Host is in the allowed hosts list

func Cache

func Cache(maxAge int) func(next router.Handler) router.Handler

func GZIP

func GZIP(next router.Handler) router.Handler

func LoginRequiredMiddleware added in v2.0.1

func LoginRequiredMiddleware(notAuth func(r *request.Request)) func(next router.Handler) router.Handler

Middleware that only allows users who are authenticated to continue. By default, will call the notAuth function. Set the following function to change the default behavior:

request.GetRequestUserFunc = func(r *request.Request) request.User {
	user = ...
	return user
}

func LoginRequiredRedirectMiddleware added in v2.0.1

func LoginRequiredRedirectMiddleware(nextURL string) func(next router.Handler) router.Handler

Middleware that only allows users who are authenticated to continue. By default, will always redirect. Set the following function to change the default behavior:

request.GetRequestUserFunc = func(r *request.Request) request.User {
	user = ...
	return user
}

func LogoutRequiredMiddleware added in v2.0.1

func LogoutRequiredMiddleware(isAuth func(r *request.Request)) func(next router.Handler) router.Handler

Middleware that only allows users who are not authenticated to continue By default, will never call the isAuth function. Set the following function to change the default behavior:

request.GetRequestUserFunc = func(r *request.Request) request.User {
	user = ...
	return user
}

func LogoutRequiredRedirectMiddleware added in v2.0.5

func LogoutRequiredRedirectMiddleware(nextURL string) func(next router.Handler) router.Handler

Middleware that only allows users who are not authenticated to continue By default, will never call the isAuth function. Set the following function to change the default behavior:

request.GetRequestUserFunc = func(r *request.Request) request.User {
	user = ...
	return user
}

func NoCache

func NoCache(next router.Handler) router.Handler

func Printer

func Printer(next router.Handler) router.Handler

func PrinterFunc added in v2.0.3

func PrinterFunc(next router.Handler, out io.Writer) router.Handler

func Recoverer

func Recoverer(next router.Handler) router.Handler

Types

This section is empty.

Jump to

Keyboard shortcuts

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