middleware

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APISecret added in v0.12.0

func APISecret(next http.Handler) http.Handler

APISecret checks the Authorization header against the configured API secret. The schema must be "Key".

func Auth added in v1.2.1

func Auth(next http.Handler) http.Handler

Auth authenticates the admin session.

func Cors

func Cors() func(next http.Handler) http.Handler

Cors configures CORS log level and origins. The configuration is not restricted by default.

func GetSession added in v1.2.1

func GetSession(r *http.Request) *model.Session

GetSession returns the session if the request was made by a signed-in user. Otherwise, nil is returned.

func GetUser added in v1.2.1

func GetUser(r *http.Request) *model.User

GetUser returns the signed-in user for the request.

func Gzip

func Gzip() func(next http.Handler) http.Handler

Gzip returns a gzip middleware.

func IsAdmin added in v1.2.1

func IsAdmin(r *http.Request) bool

IsAdmin returns whether the request is made by the administrator.

Types

This section is empty.

Jump to

Keyboard shortcuts

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