middleware

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 9 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 HandlePagination added in v0.0.12

func HandlePagination(handler PaginatedHandlerFunc) http.HandlerFunc

HandlePagination is a middleware handler that pulls pagination values and passes them along.

func RequireActivityPubOrRedirect added in v0.0.11

func RequireActivityPubOrRedirect(handler http.HandlerFunc) http.HandlerFunc

RequireActivityPubOrRedirect will validate the requested content types and redirect to the main Owncast page if it doesn't match.

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 added in v0.0.8

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

RequireExternalAPIAccessToken will validate a 3rd party access token.

func RequireUserAccessToken added in v0.0.8

func RequireUserAccessToken(handler UserAccessTokenHandlerFunc) 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 RequireUserModerationScopeAccesstoken added in v0.0.11

func RequireUserModerationScopeAccesstoken(handler http.HandlerFunc) http.HandlerFunc

RequireUserModerationScopeAccesstoken will validate a provided user's access token and make sure the associated user is enabled and has "MODERATOR" scope assigned to the user.

func SetCachingHeaders

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

SetCachingHeaders will set the cache control header of a response.

func SetHeaders added in v0.0.9

func SetHeaders(w http.ResponseWriter, nonce string)

SetHeaders will set our global headers for web resources.

Types

type ExternalAccessTokenHandlerFunc added in v0.0.8

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

ExternalAccessTokenHandlerFunc is a function that is called after validing access.

type PaginatedHandlerFunc added in v0.0.12

type PaginatedHandlerFunc func(int, int, http.ResponseWriter, *http.Request)

PaginatedHandlerFunc is a handler for endpoints that require pagination.

type UserAccessTokenHandlerFunc added in v0.0.12

type UserAccessTokenHandlerFunc func(user.User, http.ResponseWriter, *http.Request)

UserAccessTokenHandlerFunc is a function that is called after validing user access.

Jump to

Keyboard shortcuts

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