middleware

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableCache

func DisableCache(w http.ResponseWriter)

DisableCache writes the disable cache header on the responses.

func EnableCors

func EnableCors(w http.ResponseWriter)

EnableCors enables the CORS header on the responses.

func ProcessEtags

func ProcessEtags(w http.ResponseWriter, r *http.Request) int

ProcessEtags gets and sets ETags for caching purposes.

func RequireAdminAuth

func RequireAdminAuth(handler http.HandlerFunc) http.HandlerFunc

RequireAdminAuth wraps a handler requiring HTTP basic auth for it using the given the stream key as the password and and a hardcoded "admin" for username.

func RequireExternalAPIAccessToken

func RequireExternalAPIAccessToken(scope string, handler ExternalAccessTokenHandlerFunc) http.HandlerFunc

RequireExternalAPIAccessToken will validate a 3rd party access token.

func RequireUserAccessToken

func RequireUserAccessToken(handler http.HandlerFunc) http.HandlerFunc

RequireUserAccessToken will validate a provided user's access token and make sure the associated user is enabled. Not to be used for validating 3rd party access.

func SetCachingHeaders

func SetCachingHeaders(w http.ResponseWriter, r *http.Request)

SetCachingHeaders will set the cache control header of a response.

func SetHeaders

func SetHeaders(w http.ResponseWriter)

SetHeaders will set our global headers for web resources.

Types

type ExternalAccessTokenHandlerFunc

type ExternalAccessTokenHandlerFunc func(user.ExternalAPIUser, http.ResponseWriter, *http.Request)

ExternalAccessTokenHandlerFunc is a function that is called after validing access.

Jump to

Keyboard shortcuts

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