middleware

package
v0.0.0-...-8444db5 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionKeyUserID = "uid"
	SessionKeyAdmin  = "admin"
)

Variables

This section is empty.

Functions

func Authenticate

func Authenticate(next http.Handler) http.Handler

Authenticate checks that a user is associated with the request session. If no user can be found, a new one will be created

func Authorize

func Authorize(next http.Handler) http.Handler

Authorize checks that the authenticated user has an admin level authorization

func DemoteSession

func DemoteSession(w http.ResponseWriter, r *http.Request) error

DemoteSession demotes the current request session to base user authorization level

func ETag

func ETag(h http.Handler) http.Handler

func FindOrCreateAuthenticatedUser

func FindOrCreateAuthenticatedUser(w http.ResponseWriter, r *http.Request) (*repository.User, error)

FindOrCreateAuthenticatedUser retrieves the user associated with the request session. If no user can be found, a new one will be created and returned

func IsAdmin

func IsAdmin(w http.ResponseWriter, r *http.Request) (bool, error)

IsAdmin checks if the session associated with the given request has the admin authorization level

func PromoteSession

func PromoteSession(w http.ResponseWriter, r *http.Request) error

PromoteSession promotes the current request session to the admin authorization level

func PublishedAppOnly

func PublishedAppOnly(appIDParam string) func(http.Handler) http.Handler

PublishedAppOnly intercepts apps requests and returns a 404 HTTP error if the app is not published AND the user is not an admin.

func UnexpectedRedirect

func UnexpectedRedirect(host string, useTLS bool) func(http.Handler) http.Handler

UnexpectedRedirect configures the server to automatically redirect invalid host to the correct host/scheme

Types

This section is empty.

Jump to

Keyboard shortcuts

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