middlewares

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// MiddlewareStack on pREST
	MiddlewareStack []negroni.Handler

	// BaseStack Middlewares
	BaseStack = []negroni.Handler{
		negroni.Handler(negroni.NewRecovery()),
		negroni.Handler(negroni.NewLogger()),
		HandlerSet(),
		SetTimeoutToContext(),
	}
)
View Source
var (
	ErrJWTParseFail = errors.New("failed JWT token parser")
	ErrJWTValidate  = errors.New("failed JWT claims validated")
)

Functions

func AccessControl

func AccessControl() negroni.Handler

AccessControl is a middleware to handle permissions on tables in pREST

func AuthMiddleware added in v1.4.2

func AuthMiddleware() negroni.Handler

AuthMiddleware handle request token validation

func CacheMiddleware added in v1.4.2

func CacheMiddleware() negroni.Handler

CacheMiddleware simple caching to avoid equal queries to the database

func Cors deprecated added in v1.4.2

func Cors(origin []string, headers []string) negroni.Handler

Cors middleware

Deprecated: we'll use github.com/rs/cors instead

func GetApp added in v1.4.2

func GetApp() *negroni.Negroni

GetApp get negroni

func HandlerSet

func HandlerSet() negroni.Handler

HandlerSet add content type header

func JwtMiddleware

func JwtMiddleware(key string, algo string) negroni.Handler

JwtMiddleware check if actual request have JWT

func MatchURL added in v1.4.2

func MatchURL(url string) (match bool, err error)

MatchURL matches the given url with a whitelist from config.core

func SetTimeoutToContext added in v1.4.2

func SetTimeoutToContext() negroni.Handler

SetTimeoutToContext adds the configured timeout in seconds to the request context

By default it is 60 seconds, can be modified to a different value

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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