middleware

package
v0.0.0-...-e675dcb Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminOnly

func AdminOnly(ctx *context.Context, next http.Handler) http.Handler

AdminOnly middleware to allow only admin users to the next middleware in the chain

func Authenticate

func Authenticate(allowToken bool) context.Middleware

Authenticate verify that a request has either a whitelisted url or a valid auth token

func AuthenticatedOnly

func AuthenticatedOnly(ctx *context.Context, next http.Handler) http.Handler

AuthenticatedOnly middleware to allow only authenticated users to the next middleware in the chain

func Context

func Context(setupContext func(ctx *context.Context)) context.Middleware

Context sets necessary request context values

func CreateUpload

func CreateUpload(ctx *context.Context, next http.Handler) http.Handler

CreateUpload create a new upload on the fly to be used in the next handler

func File

func File(ctx *context.Context, next http.Handler) http.Handler

File retrieve the requested file metadata from the metadataBackend and save it in the request context.

func Impersonate

func Impersonate(ctx *context.Context, next http.Handler) http.Handler

Impersonate allow an administrator to pretend being another user

func Log

func Log(ctx *context.Context, next http.Handler) http.Handler

Log the http request

func Paginate

func Paginate(ctx *context.Context, next http.Handler) http.Handler

Paginate parse pagination requests

func Recover

func Recover(ctx *context.Context, next http.Handler) http.Handler

Recover the http request in case of panic

func RedirectOnFailure

func RedirectOnFailure(ctx *context.Context, next http.Handler) http.Handler

RedirectOnFailure enable webapp http redirection instead of string error

func SourceIP

func SourceIP(ctx *context.Context, next http.Handler) http.Handler

SourceIP extract the source IP address from the request and save it to the request context

func Upload

func Upload(ctx *context.Context, next http.Handler) http.Handler

Upload retrieve the requested upload metadata from the metadataBackend and save it to the request context.

func User

func User(ctx *context.Context, next http.Handler) http.Handler

User middleware for all the /user/{userID} routes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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