middleware

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: BSD-3-Clause Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlacklistCheck added in v0.8.0

func BlacklistCheck(next http.Handler, e *common.Environment, devices stores.DeviceStore, leases stores.LeaseStore) http.Handler

func Cache

func Cache(next http.Handler, e *common.Environment) http.Handler

func CheckAdmin

func CheckAdmin(next http.Handler) http.Handler

func CheckAuth

func CheckAuth(next http.Handler) http.Handler

CheckAuth is middleware to check if a user is logged in, if not it will redirect to the login page

func CheckAuthAPI added in v1.2.0

func CheckAuthAPI(next http.Handler, users stores.UserStore) http.Handler

CheckAuth is middleware to check if a user is logged in, if not it will redirect to the login page

func CheckGuestReg added in v0.14.0

func CheckGuestReg(next http.Handler, e *common.Environment, leases stores.LeaseStore) http.Handler

func CheckPermissions added in v1.5.0

func CheckPermissions(next httprouter.Handle, checker PermissionChecker) httprouter.Handle

CheckPermissions middleware ensures a session user has the required permissions to fulfill the request.

func Logging

func Logging(next http.Handler, e *common.Environment) http.Handler

func Panic

func Panic(next http.Handler, e *common.Environment) http.Handler

func SetSessionInfo

func SetSessionInfo(next http.Handler, e *common.Environment, users stores.UserStore) http.Handler

Types

type PermissionChecker added in v1.5.0

type PermissionChecker func(*http.Request, *models.User) bool

A PermissionChecker takes a request and a user and determines if the user has sufficient permissions to perform the request.

func PermsCanAny added in v1.5.0

func PermsCanAny(permissions ...models.Permission) PermissionChecker

PermsCanAny returns a permission checker that checks if the user can perform any of the supplied permissions. If any permission is allowed, the request is allowed.

Jump to

Keyboard shortcuts

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